www.delorie.com/gnu/docs/guile/r5rs_39.html   search  
Buy GNU books!

Revised(5) Scheme

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3 Macros

4.3.1 Binding constructs for syntactic keywords  
4.3.2 Pattern language  

Scheme programs can define and use new derived expression types, called macros. Program-defined expression types have the syntax

(<keyword> <datum> ...)

where <keyword> is an identifier that uniquely determines the expression type. This identifier is called the syntactic keyword, or simply keyword, of the macro. The number of the <datum>s, and their syntax, depends on the expression type.

Each instance of a macro is called a use of the macro. The set of rules that specifies how a use of a macro is transcribed into a more primitive expression is called the transformer of the macro.

The macro definition facility consists of two parts:

The syntactic keyword of a macro may shadow variable bindings, and local variable bindings may shadow keyword bindings. All macros defined using the pattern language are "hygienic" and "referentially transparent" and thus preserve Scheme's lexical scoping [Kohlbecker86], [ hygienic], [Bawden88], [macrosthatwork], [syntacticabstraction]:

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003