diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-02-20 22:16:35 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-02-20 22:16:35 -0800 |
commit | 4c5b04a6cac0d43e83aa2dc4f800eab42e908486 (patch) | |
tree | 945b7a8399e98561dd66a70f346e4b7099f04375 /txr.1 | |
parent | 87ed1d2ba09c793742e002d6d91466e4d89d36c1 (diff) | |
download | txr-4c5b04a6cac0d43e83aa2dc4f800eab42e908486.tar.gz txr-4c5b04a6cac0d43e83aa2dc4f800eab42e908486.tar.bz2 txr-4c5b04a6cac0d43e83aa2dc4f800eab42e908486.zip |
* eval.c (macro_form_p, macroexpand_1, macroexpand): New static
functions.
(eval_init): Registered new functions.
* txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -12736,6 +12736,46 @@ Examples: (let ((,var (car i))) ,*body)))) +.SS Function macro-form-p + +.TP +Syntax: + + (macro-form-p <obj>) + +.TP +Description: + +The macro-form-p function returns t if <obj> represents the syntax of +a form which is a macro form. Otherwise it returns nil. + +A macro form will transform under macroexpand-1 or macroexpand; an object +which isn't a macro form will not undergo expansion. + +.SS Functions macroexpand-1 and macroexpand + +.TP +Syntax: + + (macroexpand-1 <obj>) + (macroexpand <obj>) + +.TP +Description: + +If <obj> is a macro form (an object for which macro-form-p returns t), +these functions expand the macro form and return the expanded form. +Otherwise, they return <obj>. + +macroexpand-1 performs a single expansion, expanding just the macro +that is referenced by the symbol in the first position of <obj>, +and returns the expansion. That expansion may itself be a macro form. + +macroexpand performs an expansion, like macroexpand-1. If the result is +a macro form, then it expands that form, and keeps repeating this process +until the expansion yields a non-macro-form. That non-macro-form is then +returned. + .SS Operator tree-bind .TP |