MACRO::
Factor handbook > The language > Lexical variables

Prev:MEMO::
Next:[let


Vocabulary
locals

Syntax
MACRO:: word ( vars... -- outputs... ) body... ;


Word description
Defines a macro with named inputs. The macro binds its input variables to lexical variables from left to right, then executes the body with those bindings in scope.

If any var name is followed by an exclamation point (!), the corresponding new variable is made mutable. See Mutable lexical variables for more information.

Notes
The expansion of a macro cannot reference lexical variables bound in the outer scope. There are also limitations on passing arguments involving lexical variables into macros. See Limitations of lexical variables for details.

Examples
See Examples of lexical variables.

See also
MACRO:

Definition