chicken and egg problem. That is, it's difficult to introduce the environment in which you will write algorithms without first introducing the language in which you will write those algorithms. At the same time, you cannot start learning the language until you've learned a bit about the environment. In this reading, we will emphasize the environment, but teach you a bit about the language, too. In the paired reading, we'll teach you more about the language, but also a little bit about the environment. The lab should teach you a bit about both.
(sqrt
144).
(+ 3 4) rather than the more traditional 3 +
4.
3+4*5,
depending on whether or not they are designed to accommodate precedence.
In Scheme, since you must parenthesize every subexpression, you must
write either (+ 3 (* 4 5)) or (* (+ 3 4) 5).
Each expression indicates precisely what you want computed.
sqrt) and others
appear between their operands (such as + or
modulo), programmers must remember or look up the order to use
for each operation. In Scheme, there's never a question, because
you always put the operation first.
grade1, the grade on the second
assignment grade2, and so on and so forth. That way,
the expression to compute the average grade would be the clearer
define operation, which we put in
the definitions pane.
.scm
(or, sometimes, .ss). If you do not provide a suffix,
MediaScript will provide one for you. (If you provide a suffix other
than .scm or .ss, MediaScript will let you use
that suffix, but you may find it harder to work with the file.)
load .
You need to put the name of the file in quotation marks. For example,