diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2013-01-11 16:18:02 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2013-01-11 16:18:02 -0800 |
commit | db10f6c3b7270e033563744974bd5979fc33b014 (patch) | |
tree | 2941e38a5eb47f38b671ee123015bb73fcf5b733 /txr.1 | |
parent | 642b145b1f1941d107fac76072eae9cfc46d9567 (diff) | |
download | txr-db10f6c3b7270e033563744974bd5979fc33b014.tar.gz txr-db10f6c3b7270e033563744974bd5979fc33b014.tar.bz2 txr-db10f6c3b7270e033563744974bd5979fc33b014.zip |
* eval.c (eval_init): New instrinsic function iffi registered.
* lib.c (iff): Reversed argument names corrected. No functional
change.
(iffi): New function.
* lib.h (iffi): Declared.
* txr.1: Documented iffi.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -9394,12 +9394,13 @@ not called. If all functions return nil, then nil is returned. The expression (orf) returns a function which accepts any arguments and returns nil. -.SS Function iff +.SS Functions iff and iffi .TP Syntax: (iff <cond-func> <then-func> [<else-func>]) + (iffi <cond-func> <then-func> [<else-func>]) .TP Description: @@ -9410,10 +9411,21 @@ functional arguments and returns a function. The resulting function takes its arguments and applies them to <cond-func>. If <cond-func> yields true, then the arguments are passed to <then-func,> and the resulting value is returned. Otherwise if <cond-func> yields a false result, -and there is no <else-func,> then nil is returned. If <cond-func> yields false, +and there is no <else-func>, then nil is returned. If <cond-func> yields false, and an <else-func> exists, then the original arguments are passed to <else-func> and the resulting value is returned. +The iffi function differs from iff only in the defaulting behavior with respect +to the <else-func> argument. The following equivalence holds: + + (iffi a b c) <--> (iff a b c) + + (iffi a b) <--> (iff a b identity) + +The iffi function defaults to the identity function when <else-func> is +omitted, and therefore is useful in situations when one value is to be replaced +with another one when the condition is true, otherwise left alone. + .SH INPUT AND OUTPUT TXR Lisp supports input and output streams of various kinds, with |