summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-03-22 07:19:24 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-03-22 07:19:24 -0700
commit7d9d2c5b1b968f0d751149d7b891d3301d1b8d61 (patch)
treefaaa8d08c6ed1325324fb618b4f5910c4a2a573d
parent2f062c6f2df9ec62c1527bb17005ce529351bbc9 (diff)
downloadtxr-7d9d2c5b1b968f0d751149d7b891d3301d1b8d61.tar.gz
txr-7d9d2c5b1b968f0d751149d7b891d3301d1b8d61.tar.bz2
txr-7d9d2c5b1b968f0d751149d7b891d3301d1b8d61.zip
doc: clarifications under lambda.
* txr.1: Make it clearer that the default expression of an optional parameter is only evaluated when required. Document that t, nil and keyword symbols can't be used as parameters, and that duplicates symbols are unspecified, the situation being diagnosed by the compiler but ignored by the interpreter.
-rw-r--r--txr.122
1 files changed, 21 insertions, 1 deletions
diff --git a/txr.1 b/txr.1
index e758a790..e6784b09 100644
--- a/txr.1
+++ b/txr.1
@@ -13675,6 +13675,8 @@ In this situation, if the call does not specify a value for the parameter
(colon)) then the parameter takes on the
value of the expression
.metn expr .
+This expression is only evaluated when its value is required.
+
If
.meta sym
is specified, then
@@ -13683,7 +13685,9 @@ will be
introduced as an additional binding with a Boolean value which indicates
whether or not the optional parameter had been specified by the caller.
-The initializer expressions are evaluated an environment in which
+Each
+.code expr
+that is evaluated is evaluated an environment in which
all of the previous parameters are visible, in addition to the surrounding
environment of the lambda. For instance:
@@ -13707,6 +13711,22 @@ by the surrounding let. This reference is captured as part of the
.codn lambda 's
lexical closure.
+Keyword symbols, and the symbols
+.code t
+and
+.code nil
+may not be used as parameter names.
+The behavior is unspecified if the same symbol is specified
+more than once anywhere in the parameter list, whether as a parameter name or as
+the indicator
+.code sym
+in an optional parameter or any combination.
+
+Implementation note: the \*(TX compiler diagnoses and rejects duplicate
+symbols in
+.code lambda
+whereas the interpreter ignores the situation.
+
.TP* Examples:
.IP "Counting function:"
This function, which takes no arguments, captures the