summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-12-04 16:27:31 -0800
committerKaz Kylheku <kaz@kylheku.com>2011-12-04 16:27:31 -0800
commit45376e552a18a2991421a8df34c931d56ecdd31d (patch)
tree093d00994cc6a6a556f8e7e22b69a342af7c073f /txr.1
parent336071aa972798af0252345d90e0a8d4acdc1e00 (diff)
downloadtxr-45376e552a18a2991421a8df34c931d56ecdd31d.tar.gz
txr-45376e552a18a2991421a8df34c931d56ecdd31d.tar.bz2
txr-45376e552a18a2991421a8df34c931d56ecdd31d.zip
* eval.c (op_qquote_error, op_unquote_error): New static functions.
(expand_qquote): Bugfix: missing case added to handle directly quoted quasiquote. (eval_init): Error-catching pseudo-operators registered in op_table. * parser.y (force_regular_quotes): New function. (list): Quotes within unquotes and splices are regular. * txr.1: Clarified new rules. Removed description of ,'form and ,*'form special syntax.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.146
1 files changed, 15 insertions, 31 deletions
diff --git a/txr.1 b/txr.1
index 0ad576c7..7a21a2b3 100644
--- a/txr.1
+++ b/txr.1
@@ -4223,11 +4223,16 @@ value of 'a is the symbol a itself, whereas the value of a is the value
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.
+There is only one quote, which supports unquoting. The quote behaves
+either like a quasiquote or a regular quote according to these rules:
-A quoted form which contains no unquotes codifies an ordinary quote.
+1. A quoted form which contains no unquotes or splices is an ordinary quote.
-A quoted form which contains unquotes expresses a quasiquote.
+2. Quotes occuring within forms that are unquoted or spliced are ordinary
+quotes, not quasiquotes.
+
+3. Quotes which contain unquotes and splices and are not within unquotes
+or splices are quasiquotes.
.IP ,form
@@ -4239,34 +4244,13 @@ in the quote stands for itself, except for the ,(+ 2 2) which is evaluated.
.IP ,*form
-The comma-star operator is used within a quoted list to denote a splicing unquote.
-Wheras the quote suppresses evaluation, the comma introduces an exception:
-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
+The comma-star operator is used within a quoted list to denote a splicing
+unquote. Wheras the quote suppresses evaluation, the comma introduces an
+exception: 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
@@ -4279,8 +4263,8 @@ quote, which protects it from evaluation. To get the (+ 1 2) value "through"
to the inner quote, the unquote syntax must also be nested using multiple
commas, like this: '(1 2 3 '(4 5 6 ,',(+ 1 2))). The leftmost comma goes
with the innermost quote. The quote between the commas protects the (+ 1 2)
-from repeated evaluations: the two unquotes call for two evaluations, but
-we only want (+ 1 2) to be evaluated once.
+from repeated evaluations. According to rule 2 above, it is a regular
+quote, and so it does not capture the following comma.
.SS Lisp Operators