Variable definitions

A variable definition binds one or more identifiers and specifies an initial value for each of them. The simplest kind of variable definition takes one of the following forms:

  • (define variable expression)
  • (define (variable formals) body)
    Formals are 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 is a single variable. This form is equivalent to (define variable (lambda formal body)).

husk-scheme online documentation rev 3.2 (2021.03.04)