manual enhancement

Started by csfreebird, November 04, 2013, 01:25:05 AM

Previous topic - Next topic

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.


(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

Lutz

#1
perhaps better: "expand is useful when composing lambda expressions and doing variable expansion as in rewrite macros."