Page 1 of 1

manual enhancement

Posted: Mon Nov 04, 2013 9:25 am
by csfreebird
When reading expand chapter, there is:
expand is useful when composing lambda expressions or doing variable expansion inside macros.
But the example code below is nothing to do with macros.

Code: Select all

(define (raise-to power)
  (expand (fn (base) (pow base power)) 'power))

(define square (raise-to 2))
(define cube (raise-to 3))

(square 5)  → 25
(cube 5)    → 125

Re: manual enhancement

Posted: Mon Nov 04, 2013 5:44 pm
by Lutz
perhaps better: "expand is useful when composing lambda expressions and doing variable expansion as in rewrite macros."