manual enhancement

Q&A's, tips, howto's
Locked
csfreebird
Posts: 107
Joined: Tue Jan 15, 2013 11:54 am
Location: China, Beijing
Contact:

manual enhancement

Post 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

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: manual enhancement

Post by Lutz »

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

Locked