Next: Internal definitions, Up: Variable definitions [Index]
At the outermost level of a program, a definition
(define ⟨variable⟩ ⟨expression⟩)
has essentially the same effect as the assignment expression
(set! ⟨variable⟩ ⟨expression⟩)
if ⟨variable⟩ is bound to a non-syntax value. However, if
⟨variable⟩ is not bound, or is a syntactic keyword, then the
definition will bind ⟨variable⟩ to a new location before performing
the assignment, whereas it would be an error to perform a set!
on
an unbound variable.
(define add3 (lambda (x) (+ x 3))) (add3 3) ⇒ 6 (define first car) (first '(1 2)) ⇒ 1