In C or Pascal, a call to procedure
foo with arguments
baz is written
but in Scheme it's written
(foo bar baz)
Note that the procedure name goes inside the parentheses, along
with the arguments. Get used to it. It may seem less odd if you think
of it as being like a operating system shell command--e.g.,
dir bar---but delimited by parentheses.
Just as in C, expressions can be nested. Here's a call to a procedure
foo, with nested procedure call expressions to compute the arguments.
(foo (bar x) (baz y))
This expression is pretty much equivalent to C's
As in C or Pascal, the argument expressions in a procedure call are evaluated before the procedure is called; the resulting values are what's passed to the procedure. In Scheme terminology, we say that the procedure is applied to the actual argument values.
You'll notice soon that Scheme has very few special characters, and
that expressions are generally delimited by parentheses or spaces.
a-variable is a single identifier, not a subtraction
expression. Identifiers in Scheme can include not only alphabetic
characters and digits, but several other characters, such as
_. Long identifiers are often
constructed from phrases, to make it clear what they mean, using hyphens
to separate words; for example, you can have a variable named
lists. You can use characters
/ within an identifier,
One consequence of Scheme's liberal rules for constructing identifiers
is that spaces are important. You must put one or more spaces
(or carriage returns) between identifiers except where special characters
(usually parentheses) make the divisions obvious. For example, the
(+ 1 a) can't be written
(+1 a) or
(+ 1a). (It can be written
( + 1 a ),
because extra whitespace between tokens is ignored.)