Next: , Previous: , Up: chains   [Index]


35.9 Filtering in chains

The following syntactic bindings are exported by the library (vicare containers chains). The syntactic bindings whose name is prefixed with $ are unsafe operations: they do not validate their arguments before accessing them.

Function: chain-filter-forwards pred chain
Function: chain-filter-forwards pred chain

Build and return a new chain. Iterate over the objects in chain, starting from chain and proceeding forwards, apply pred to them, push on the rear of the return value the ones for which pred returns true.

Function: chain-partition-forwards pred chain
Function: chain-partition-forwards pred chain

Build and return two new chains: the matching one and the not–matching one. Iterate over the objects in chain, starting from chain and proceeding forwards, and apply pred to them: if the return value is true, push the object on the rear of the matching chain; if the return value is #f, push the object on the rear of the not–matching chaing.