“Welcome to CS 61AS, the world's best computer science course, because we use
the world's best CS book as the textbook. The only thing wrong with this course
is that all the rest of the CS courses for the rest of your life will seem a
little disappointing (and repetitive).”
This lab runs through the basics of the Scheme programming language, and
also some of the need to know information regarding CS61AS. Labs are structured
so that you learn by exploring, making mistakes, asking questions,
and otherwise trying things out. Have fun!
Labwork
finish this during section
Exercise 0.
Fire up the interpreter (your TA will explain how)
and try these out, starting from the left column:
What do you think the parens do? What do you think ' does?
What do you think define does? Confirm with your TA.
Exercise 1.
Parens are very important in
Scheme.
In order to call on a procedure to do something,
you MUST wrap the procedure in parens with its arguments,
or the data you want it to act on. For example, from above,
typing (+ 2 3) into the interpreter outputs 5.
You can also include subexpressions in a procedure call
in order to do more complicated things, like (+ (* 3 4) 5).
However, parens don't always mean "call a procedure to do something".
More on this later.