3 minutes, 10 seconds
Expressions, Types, and Functions
- slide 31 : 46
Definitions
A
definition
binds a name to a value
(define name expression)
About Scheme
define
forms
Appears normally at
top level
in a program
Creates a new location named
name
and binds the value of
expression
to that location
In case the location already exists we have a
redefinition
, and the
define
form is equivalent to the assignment
(set! name expr)
Does not allow for imperative programming, because
define
cannot appear in selections, iterations, etc.
Can also appear at certain positions in bodies, but only as syntactic sugar for local binding forms (
letrec
)
R5RS: Definitions