Warning: This is the manual of the legacy Guile 2.2 series. You may want to read the manual of the current stable series instead.
Next: SRFI-1 Searching, Previous: SRFI-1 Fold and Map, Up: SRFI-1 [Contents][Index]
Filtering means to collect all elements from a list which satisfy a specific condition. Partitioning a list means to make two groups of list elements, one which contains the elements satisfying a condition, and the other for the elements which don’t.
The filter
and filter!
functions are implemented in the
Guile core, See List Modification.
Split lst into those elements which do and don’t satisfy the predicate pred.
The return is two values (see Multiple Values), the first being a list of all elements from lst which satisfy pred, the second a list of those which do not.
The elements in the result lists are in the same order as in lst
but the order in which the calls (pred elem)
are made on
the list elements is unspecified.
partition
does not change lst, but one of the returned
lists may share a tail with it. partition!
may modify
lst to construct its return.
Return a list containing all elements from lst which do not satisfy the predicate pred. The elements in the result list have the same order as in lst. The order in which pred is applied to the list elements is not specified.
remove!
is allowed, but not required to modify the structure of
the input list.