summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-12-02 15:39:43 -0800
committerKaz Kylheku <kaz@kylheku.com>2011-12-02 15:39:43 -0800
commit63211dfd66f3cbd4159885018257022b20a4c975 (patch)
tree3f38e75739cd8e2f0cdb9e33c903968805580e95 /txr.1
parent6768cdf7a46856355ccfafc57f147fac14eba06b (diff)
downloadtxr-63211dfd66f3cbd4159885018257022b20a4c975.tar.gz
txr-63211dfd66f3cbd4159885018257022b20a4c975.tar.bz2
txr-63211dfd66f3cbd4159885018257022b20a4c975.zip
* parser.y (list): unquote and splice actions look inside the
argument form. If an unquote or splice are applied to a quoted form, its quote becomes a regular quote. This behavior is necessary to make ,',form work in nested quotes, otherwise the ' is a quasiquote which captures the comma in ,form, reducing ,',form to ,form. * txr.1: Documented this special behavior.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.126
1 files changed, 26 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index 86877df4..808c7c9d 100644
--- a/txr.1
+++ b/txr.1
@@ -4225,6 +4225,10 @@ of the variable a.
Note that TXR Lisp does not have a distinct quote and backquote syntax.
There is only one quote, which supports unquoting.
+A quoted form which contains no unquotes codifies an ordinary quote.
+
+A quoted form which contains unquotes expresses a quasiquote.
+
.IP ,form
Thes comma character is used within a quoted list to denote an unquote. Wheras
@@ -4241,6 +4245,28 @@ the form which follows ,* must evaluate to a list. That list is spliced into
the quoted list. For example: '(a b c ,*(list (+ 3 3) (+ 4 4) d) evaluates
to (a b c 6 8 d). The expression (list (+ 3 3) (+ 4 4)) is evaluated
to produce the list (6 8), and this list is spliced into the quoted template.
+
+.IP ,'form
+
+The comma-quote combination has a special meaning: the quote always
+behaves as a regular quote and not a quasiquote, even if form contains
+unquotes. Therefore, it does not "capture" these unquotes: they cannot
+"belong" to this quote. The comma and quote "cancel out", so the only effect
+of comma-quote is to add one level of unquoting. So for instance, whereas in
+'(a b c '(,d)), the subsitution of d belongs to the inner quote (it is unquoted
+by the leftmost comma which belongs to the innermost quote) by contrast,
+in '(a b c '(,',d)) the d is now one comma removed from the leftmost comma and
+thus the substitution of d belongs to the outer quote.
+In other dialects of Lisp, this would be written `(a b c `(,',d)), making it
+explicit which kind of quote is being specified. TXR Lisp works out which
+kind of quote to use internally.
+
+.IP ,*'form
+
+The comma-splice form is analogous to comma-quote (see above). Like in the
+,' combination, in the ,*' combination, the quote behaves as a regular quote
+and not a quasiquote.
+
.PP
.SS Nested Quotes