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


38.7 Filtering in deques

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

Function: deque-filter dst-deque pred src-deque
Function: $deque-filter dst-deque pred src-deque

Iterate over the objects in src-deque starting from the front side, apply pred to them, push on the rear of dst-deque the ones for which pred returns true. Return dst-deque itself.

The argument dst-queue allows us to build and configure a deque with the needed parameters.

Function: deque-partition match-deque no-match-deque pred src-deque
Function: $deque-partition match-deque no-match-deque pred src-deque

Iterate over the objects in src-deque, starting from the front side, and apply pred to them: if the return value is true, push the object on the rear of match-deque; if the return value is #f, push the object on the rear of no-match-deque. Return two values: match-deque and no-match-deque.

The arguments match-deque and no-match-deque allow us to build and configure deques with the needed parameters.