Next: , Previous: Dynamic Binding, Up: Special Forms


2.4 Definitions

— special form: define variable [expression]
— special form: define formals expression expression ...

Definitions are valid in some but not all contexts where expressions are allowed. Definitions may only occur at the top level of a program and at the beginning of a lambda body (that is, the body of a lambda, let, let*, letrec, fluid-let, or “procedure define” expression). A definition that occurs at the top level of a program is called a top-level definition, and a definition that occurs at the beginning of a body is called an internal definition.

In the second form of define (called “procedure define”), the component formals is identical to the component of the same name in a named-lambda expression. In fact, these two expressions are equivalent:

          (define (name1 name2 ...)
            expression
            expression ...)
          
          (define name1
            (named-lambda (name1 name2 ...)
              expression
              expression ...))