[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.2.6 List filtering & partitioning

Function: filter pred list
Function: filter! pred list
[SRFI-1] A procedure pred is applied on each element of list, and a list of elements that pred returned true on it is returned.
 
(filter odd? '(3 1 4 5 9 2 6)) => (3 1 5 9)
filter! is the linear-update variant. It may destructively modifies list to produce the result.

Function: remove pred list
Function: remove! pred list
[SRFI-1] A procedure pred is applied on each element of list, and a list of elements that pred returned false on it is returned.
 
(remove odd? '(3 1 4 5 9 2 6)) => (4 2 6)
remove! is the linear-update variant. It may destructively modifies list to produce the result.

Function: partition pred list
Function: partition! pred list
[SRFI-1] filter and remove simultaneously, i.e. returns two lists, the first is the result of filtering elements of list by pred, and the second is the result of removing elements of list by pred.
 
(partition odd? '(3 1 4 5 9 2 6))
  => (3 1 5 9) (4 2 6)
partition! is the linear-update variant. It may destructively modifies list to produce the result.

Function: filter$ pred
Function: remove$ pred
Function: partition$ pred
Partial application versions of filter, remove and partition.



This document was generated by Ken Dickey on November, 28 2002 using texi2html