Next: scheme overview definitions, Previous: scheme overview expressions, Up: scheme overview [Index]
Scheme allows identifiers to stand for locations containing values. These identifiers are called variables. In many cases, specifically when the location’s value is never modified after its creation, it is useful to think of the variable as standing for the value directly.
(let ((x 23) (y 42)) (+ x y)) ⇒ 65
In this case, the expression starting with let
is a binding
construct. The parenthesized structure following the let
lists
variables alongside expressions: the variable ‘x’ alongside
‘23’, and the variable ‘y’ alongside ‘42’. The
let
expression binds ‘x’ to ‘23’, and ‘y’ to
‘42’. These bindings are available in the body of the
let
expression, (+ x y)
, and only there.