diff options
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 60 |
1 files changed, 40 insertions, 20 deletions
@@ -45099,17 +45099,19 @@ an anonymous function which, if called with one argument, stores that argument into .codn x . -The argument forms are arbitrary expressions, within which a special -convention is permitted: +The argument forms are arbitrary expressions, within which special +conventions is permitted regarding the use of certain implicit variables: .RS .meIP >> @ num A number preceded by a .code @ -is a metanumber. This is a special syntax -which denotes an argument. For instance +is, syntactically, a metanumber. If it appears inside +.code op +as an expression, it behaves as a positional argument, whose +existence it implies. For instance .code @2 -means that the second argument of -the anonymous function is to be substituted in place of the +means that the function shall have at least two arguments, +the second argument of which is be substituted in place of the .codn @2 . .code op generates a function which has a number of required arguments equal to the @@ -45127,14 +45129,29 @@ argument to returning the result, and ignores its first two arguments). There is no way to use .code op -to generate functions which have optional arguments. +to generate functions which have optional arguments. The positional +arguments are mutable; they may be assigned. .meIP < @rest If the meta-symbol .meta @rest appears in the .code op -syntax, it explicitly denotes the list of trailing arguments, -allowing them to be placed anywhere in the expression. +syntax as an expression, it explicitly denotes and evaluates to the list of +trailing arguments. Like the metanumber positional arguments, it +may be assigned. +.meIP < @rec +If the meta-symbol +.meta @rec +appears in the +.code op +syntax as an expression, it denotes a mutable variable which is bound to the +function itself which is generated by that +.code op +expression. +.meIP >> @( rec ...) +If this syntax appears inside +.codn op , +it specifies a recursive call the function. .RE .IP @@ -45155,7 +45172,7 @@ syntax, then is implicitly inserted. What this means is that, for example, since the form .code "(op foo)" -does not contain any numeric positional arguments like +does not contain any implicit positional arguments like .codn @1 , and does not contain .codn @rest , @@ -45231,10 +45248,11 @@ The and .code do operators can be nested, in any combination. This raises the -question: if a metanumber like -.code @1 -or +question: if an expression like +.codn @1 , .code @rest +or +.code @rec occurs in an .code op that is nested @@ -45242,22 +45260,24 @@ within an .codn op , what is the meaning? -A metanumber always belongs with the inner-most op or do operator. So for -instance +An expression with a single +.code @ +always belongs with the inner-most op or do +operator. So for instance .code "(op (op @1))" means that an .code "(op @1)" expression is nested -within an +within an outer .code op -expression which itself contains no meta-syntax. +expression that contains no references to its implicit variables. The .code @1 -belongs with the inner op. +belongs to the inner op. There is a way for an inner .code op -to refer to an outer op metanumber argument. This is +to refer to the implicit variables of an outer one. This is expressed by adding an extra .code @ prefix for every level of escape. For example in @@ -45296,7 +45316,7 @@ a parameter from the outermost into the innermost .codn op . -Note that meta-numbers and meta-symbols belonging to an +Note that the implicit variables belonging to an .code op can be used in the dot position of a function call, such as: |