diff options
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 38 |
1 files changed, 37 insertions, 1 deletions
@@ -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: |