[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

The generality of define

One of my students has discovered that the template syntax for
defining procedures is quite general, a fact which might be
obvious, but should be pointed out.

Although I knew that

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

is equivalent to

     (define square (lambda (x) (* x x))),

I did not realize that something like

     (define ((linear a b) x) (+ a (* b x)))

is possible and is equivalent to

     (define (linear a b) (lambda (x) (+ (* b x)))).

Roger Kirchner, Carleton College