Top level definitions

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 variable.

(define add3 (lambda (x) (+ x 3))) (add3 3) ==> 6 (define first car) (first '(1 2)) ==> 1

husk-scheme online documentation rev 3.2 (2021.03.04)