In order to write programs, we need to be able to give names to things. The special form define associates a name with a value; this is called a binding. The form (define (square x) (* x x)) is processed as if it were (define square (lambda (x) (* x x))), thus binding the name square to its function definition. lambda is described on page 157.

   > (define pi 3.1415926535)

> pi 3.1415926535

> (define (square x) (* x x)) square

> (square 7) 49

> (define (circle-area r) (* pi (square r))) circle-area

> (circle-area 10) 314.15926535

Contents    Page-10    Prev    Next    Page+10    Index