diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-07-19 10:24:10 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-07-19 10:24:10 -0700 |
commit | 53fb3e6b09dbe62d66c516870855ba448f56c4b0 (patch) | |
tree | 6489c60e0517780cdc95252462b9f4865a7f5514 /txr.1 | |
parent | 5b0a9e5fe1032653c745e56a2f39561a1d7b7661 (diff) | |
download | txr-53fb3e6b09dbe62d66c516870855ba448f56c4b0.tar.gz txr-53fb3e6b09dbe62d66c516870855ba448f56c4b0.tar.bz2 txr-53fb3e6b09dbe62d66c516870855ba448f56c4b0.zip |
* eval.c (mapdov): New function.
(eval_init): Register mapdo intrinsic.
* lib.c (mapdo): New function.
* lib.h (mapdo): Declared.
* txr.1: Documented mapdo. Documented zero-argument case
for mapcar, mapcar*, mappend and mappend*.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 38 |
1 files changed, 33 insertions, 5 deletions
@@ -8058,15 +8058,18 @@ preserved. .TP Syntax: - (mapcar <function> <list> <list>*) - (mappend <function> <list> <list>*) - (mapcar* <function> <list> <list>*) - (mappend* <function> <list> <list>*) + (mapcar <function> <list>*) + (mappend <function> <list>*) + (mapcar* <function> <list>*) + (mappend* <function> <list>*) .TP Description: -When given three arguments, the mapcar function applies <function> to +When given only one argument, the mapcar function returns nil. +The <function> is never called. + +When given two arguments, the mapcar function applies <function> to the elements of <list> and returns a list of the resulting values. Essentially, the list is filtered through the function. @@ -8124,6 +8127,31 @@ Examples: (mappend (lambda (item) (if (evenp x) (list x))) '(1 2 3 4 5)) -> (2 4) +.SS Function mapdo + +.TP +Syntax: + + (mapdo <function> <sequence>*) + +.TP +Description: + +The mapdo function is similar to mapcar, but always returns nil. It is useful +when <function> performs some kind of side effect, hence the "do" in the name, +which is a mnemonic for the execution of imperative actions. + +When only the <function> argument is given, the function is never called, +and nil is returned. + +If a single <sequence> argument is given, then mapdo iterates over +<sequence>, invoking <function> on each element. + +If two or more <sequence> arguments are given, then mapdo iterates over +the sequences in parallel, extracting parallel tuples of items. These +tuples are passed as arguments to <function>, which must accept as many +arguments as there are sequences. + .SS Functions transpose and zip .TP |