summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-04-15 15:15:23 -0700
committerKaz Kylheku <kaz@kylheku.com>2012-04-15 15:15:23 -0700
commit20a737a17009582fd3022fb2f67e4b472445bc4f (patch)
tree371c8cfa1d0f5d79fc456249e76443dc9f46cd06 /txr.1
parent10083ef8d5be31db094ce70d0021d23aecdb9249 (diff)
downloadtxr-20a737a17009582fd3022fb2f67e4b472445bc4f.tar.gz
txr-20a737a17009582fd3022fb2f67e4b472445bc4f.tar.bz2
txr-20a737a17009582fd3022fb2f67e4b472445bc4f.zip
* eval.c (eval_init): New intrinsic functions remq*, remql*,
remqual*, remove-if*, keep-if*. * lib.c (rem_lazy_func, rem_lazy_rec): New static functions. (remq_lazy, remql_lazy, remqual_lazy, remove_if_lazy, keep_if_lazy): New functions. * lib.h (remq_lazy, remql_lazy, remqual_lazy, remove_if_lazy, keep_if_lazy): Declared. * txr.1: New functions documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.138
1 files changed, 37 insertions, 1 deletions
diff --git a/txr.1 b/txr.1
index 6a84a6be..81583d97 100644
--- a/txr.1
+++ b/txr.1
@@ -6670,13 +6670,46 @@ The input <list> is unmodified, but the returned list may share substructure
with it. If no items are removed, it is possible that the return value
is <list> itself.
-.SS Function remove-if
+.SS Functions remq*, remql* and remqual*
+
+.TP
+Syntax:
+
+ (remq* <object> <list>)
+ (remql* <object> <list>)
+ (remqual* <object> <list>)
+
+.TP
+Description:
+
+The remq*, remql* and remqual* functions are lazy versions of
+remq, remql and remqual. Rather than computing the entire new list
+prior to returning, these functions return a lazy list.
+
+Caution: these functions can still get into infinite looping behavior.
+For instance, in (remql* 0 (repeat '(0))), remql will keep consuming
+the 0 values coming out of the infinite list, looking for the first item that
+does not have to be deleted, in order to instantiate the first lazy value.
+
+.TP
+Examples:
+
+ ;; Return a list of all the natural numbers, excluding 13,
+ ;; then take the first 100 of these.
+ ;; If remql is used, it will loop until memory is exhausted,
+ ;; because (range 1) is an infinite list.
+
+ [(remql* 13 (range 1)) 0..100]
+
+.SS Functions remove-if, keep-if, remove-if* and keep-if*
.TP
Syntax:
(remove-if <predicate-function> <list> : <key-function>)
(keep-if <predicate-function> <list> : <key-function>)
+ (remove-if* <predicate-function> <list> : <key-function>)
+ (keep-if* <predicate-function> <list> : <key-function>)
.TP
Description
@@ -6696,6 +6729,9 @@ The keep-if function is exactly like remove-if, except the sense of
the predicate is inverted. The function keep-if retains those items
which remove-if will delete, and removes those that remove-if will preserve.
+The remove-if* and keep-if* are like remove-if and keep-if, but
+produce lazy lists.
+
.TP
Examples: