From 80c985bc48a448e53ee5ef9c5e4910f598f5af7e Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 7 Mar 2024 19:57:05 -0800 Subject: doc: improvements in dwim and call documentation * txr.1: Under call function, document that callable objects need not be functions; the dwim operator description has the details. Fix a formatting problem in the dwim operator syntax synopsis. Under dwim, clarify in more detail that the behavior for various objects are a consequence of their function calling semantics, rather than inherent in the dwim operator. --- txr.1 | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/txr.1 b/txr.1 index d25ae889..25ae880a 100644 --- a/txr.1 +++ b/txr.1 @@ -15850,6 +15850,13 @@ function invokes .metn function , passing it the given arguments, if any. +.meta function +need not be a function; other kinds of objects +can be used in place of functions with various semantics. +The details are given in the description of the +.code dwim +operator. + .TP* Examples: Apply .code lambda @@ -16069,7 +16076,7 @@ retrieve a global macro expander using the function .mets (set (dwim >> { integer | << range } << obj-place ) << new-value ) .mets <> '[' argument *']' .mets (set >> '[' obj-place < index <> [ alt ]']' << new-value ) -.mets (set >> '[{' integer | << range } << obj-place']' << new-value ) +.mets (set >> '[{' integer | << range } << obj-place ']' << new-value ) .syne .desc The @@ -16425,10 +16432,17 @@ according to the endpoints of .RE .PP -Note that the various above forms are not actually special cases of +Note that the various above forms are not actually cases of the .code dwim -but the consequence of the objects appearing as the first argument being -callable as functions, and their respective semantics. +operator but the due to the semantics of the left argument objects being used +as functions. All of the semantics described above is available in any +situation in which an object is used as a function: for instance, as an +argument of the +.code call +or +.code apply +operators, or the functional argument in +.codn mapcar . .TP* "Range Indexing:" Vector and list range indexing is based from zero, meaning -- cgit v1.2.3