Next: , Previous: , Up: srfi ilists procs   [Index]


2.40.6.7 Filtering and partitioning

Function: ilist ifilter pred ilist

Return all the elements of ilist that satisfy predicate pred. The ilist is not disordered: elements that appear in the result ilist occur in the same order as they occur in the argument ilist. The returned ilist may share a common tail with the argument ilist. The dynamic order in which the various applications of pred are made is not specified.

(ifilter even? (iq 0 7 8 8 43 -4)) ⇒ (0 8 8 -4)
Function: ilist ilist ipartition pred ilist

Partitions the elements of ilist with predicate pred, and returns two values: the ilist of in–elements and the ilist of out–elements. The ilist is not disordered: elements occur in the result ilists in the same order as they occur in the argument ilist. The dynamic order in which the various applications of pred are made is not specified. One of the returned ilists may share a common tail with the argument ilist.

(ipartition symbol? (iq one 2 3 four five 6))
⇒ (one four five) (2 3 6)
Function: ilist iremove pred ilist

Return ilist without the elements that satisfy predicate pred:

(lambda (pred ilist)
  (ifilter (lambda (x)
             (not (pred x)))
    ilist))

The ilist is not disordered: elements that appear in the result ilist occur in the same order as they occur in the argument ilist. The returned ilist may share a common tail with the argument ilist. The dynamic order in which the various applications of pred are made is not specified.

(iremove even? (iq 0 7 8 8 43 -4)) ⇒ (7 43)

Next: , Previous: , Up: srfi ilists procs   [Index]