Next: LOL Iteration, Previous: Efficient Accumulation, Up: Top
This module provides an implementation of Common Lisp list functions for Guile. To load it:
(use-modules (ice-9 common-list))
See SRFI-1, for another list library.
Return list L, possibly with element E added if it is not already in L.
Return a new list that is the union of L1 and L2. Elements that occur in both lists occur only once in the result list.
Return a new list that is the intersection of L1 and L2. Only elements that occur in both lists occur in the result list.
Same as `reduce' except it implicitly inserts INIT at the start of L.
reduceis a variant offold. If lst is(), ridentity is returned. Otherwise,(fold (carlst) (cdrlst))is returned.
PRED is a boolean function of as many arguments as there are list arguments to `some', i.e., L plus any optional arguments. PRED is applied to successive elements of the list arguments in order. As soon as one of these applications returns a true value, return that value. If no application returns a true value, return #f. All the lists should have the same length.
Apply pred across the lists and return a true value if the predicate returns true for every of the list elements(s); return
#fotherwise. The true value returned is always the result of the final successful application of pred.
Return #t iff every application of PRED to L, etc., returns #f. Analogous to some but returns #t if no application of PRED returns a true value or #f as soon as any one does.
Return #t iff there is an application of PRED to L, etc., that returns #f. Analogous to some but returns #t as soon as an application of PRED returns #f, or #f otherwise.
Return the number of elements in L for which (PRED element) returns true.
Search for the first element in L for which (PRED element) returns true. If found, return that element, otherwise return #f.
Remove all elements from L where (PRED element) is true. Return everything that's left.
Remove all elements from L where (PRED element) is #f. Return everything that's left.
Apply P to each element of L, returning a list of elts for which P returns a non-#f value.