| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
5.2 Definitions
| 5.2.1 Top level definitions | ||
| 5.2.2 Internal definitions |
Definitions are valid in some, but not all, contexts where expressions are allowed. They are valid only at the top level of a <program> and at the beginning of a <body>.
A definition should have one of the following forms:
- (define <variable> <expression>)
- (define (<variable> <formals>) <body>)
<Formals> should be either a sequence of zero or more variables, or a sequence of one or more variables followed by a space-delimited period and another variable (as in a lambda expression). This form is equivalent to
(define <variable> (lambda (<formals>) <body>)).
- (define (<variable> . <formal>) <body>)
<Formal> should be a single variable. This form is equivalent to
(define <variable> (lambda <formal> <body>)).
