diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-03-22 07:19:24 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-03-22 07:19:24 -0700 |
commit | 7d9d2c5b1b968f0d751149d7b891d3301d1b8d61 (patch) | |
tree | faaa8d08c6ed1325324fb618b4f5910c4a2a573d /txr.1 | |
parent | 2f062c6f2df9ec62c1527bb17005ce529351bbc9 (diff) | |
download | txr-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.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -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 |