Next: , Previous: Scheme Syntax Extension Packages, Up: Scheme Syntax Extension Packages


3.1 Defmacro

Defmacros are supported by all implementations.

— Function: gentemp

Returns a new (interned) symbol each time it is called. The symbol names are implementation-dependent

          (gentemp) ⇒ scm:G0
          (gentemp) ⇒ scm:G1
— Function: defmacro:eval e

Returns the slib:eval of expanding all defmacros in scheme expression e.

— Function: defmacro:load filename

filename should be a string. If filename names an existing file, the defmacro:load procedure reads Scheme source code expressions and definitions from the file and evaluates them sequentially. These source code expressions and definitions may contain defmacro definitions. The defmacro:load procedure does not affect the values returned by current-input-port, current-error-port, and current-output-port.

— Function: defmacro? sym

Returns #t if sym has been defined by defmacro, #f otherwise.

— Function: macroexpand-1 form
— Function: macroexpand form

If form is a macro call, macroexpand-1 will expand the macro call once and return it. A form is considered to be a macro call only if it is a cons whose car is a symbol for which a defmacro has been defined.

macroexpand is similar to macroexpand-1, but repeatedly expands form until it is no longer a macro call.

— Macro: defmacro name lambda-list form ...

When encountered by defmacro:eval, defmacro:macroexpand*, or defmacro:load defines a new macro which will henceforth be expanded when encountered by defmacro:eval, defmacro:macroexpand*, or defmacro:load.

3.1.1 Defmacroexpand

(require 'defmacroexpand)

— Function: defmacro:expand* e

Returns the result of expanding all defmacros in scheme expression e.