summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-08-31 22:39:55 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-08-31 22:39:55 -0700
commit0f429919165a9b097c61ecb9c6e36111c379489a (patch)
tree96cfe0c7254dc46ccd475d64e4a7f8a24bf3de0a /txr.1
parent5717a5656e0486daba71ae0eae733f252840cffd (diff)
downloadtxr-0f429919165a9b097c61ecb9c6e36111c379489a.tar.gz
txr-0f429919165a9b097c61ecb9c6e36111c379489a.tar.bz2
txr-0f429919165a9b097c61ecb9c6e36111c379489a.zip
new: macroexpand-lisp1 and macroexpand-1-lisp1.
* eval.c (do_macroexpand_1, do_macroexpand): New static functions; take symbol macro lookup function poiner as argument. (macroexpand_1): Reimplemented as wrapper around do_macroexpand_1. (macroexpand): Reimplemented as wrapper around do_macroexpand. (macroexpand_1_lisp1, macroexpand_lisp1): New static functions. (eval_init): Registered intrinsics macroexpand-1-lisp1 and macroexpand-lisp1. * txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.139
1 files changed, 39 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index 72ad9949..ed998606 100644
--- a/txr.1
+++ b/txr.1
@@ -30172,6 +30172,45 @@ and
.code a
respectively.
+.coNP Functions @ macroexpand-1-lisp1 and @ macroexpand-lisp1
+.synb
+.mets (macroexpand-1-lisp1 < obj <> [ env ])
+.mets (macroexpand-lisp1 < obj <> [ env ])
+.syne
+.desc
+The
+.code macroexpand-1-lisp1
+and
+.code macroexpand-lisp1
+functions closely resemble, respectively,
+.code macroexpand-1
+and
+.codn macroexpand .
+
+The argument and return value syntax and semantics is almost
+identical, except for one difference. These functions consider argument
+.meta obj
+to be syntax in a Lisp-1 evaluation context, such as any argument
+position of the
+.code dwim
+operator, or the equivalent DWIM Brackets notation.
+
+This makes a difference because in a Lisp-1 evaluation context, an
+inner function binding is able to shadow an outer symbol macro binding
+of the same name.
+
+The requirements about this language area are given in more
+detail in the description of the
+.code dwim
+operator.
+
+Note: the
+.code macroexpand-lisp1
+function is useful to the implementor of a macro whose semantics requires
+one or more argument forms to be treated in a Lisp-1 context, in situations
+when such a macro needs to itself expand the material, rather than merely
+insert it as-is into the output code template.
+
.coNP Functions @ lexical-var-p and @ lexical-fun-p
.synb
.mets (lexical-var-p < env << form )