Macros
A macro is a special form that translates its code into new code. That is, instead of performing the desired computation, the macro produces new code that performs the computation. A macro thereby provides a way of extending a language.
In Lisp, we can think of a macro call as being like a function call that is evaluated twice:
A macro is defined using the form: (This form is used by DrScheme.
Other versions of Scheme use different forms.)
(define-macro name
      (lambda (arguments ) code ))
A macro definition looks like an ordinary function definition, but the value returned by the macro is Lisp code to do what is wanted.
Contents    Page-10    Prev    Next    Page+10    Index