Next: , Previous: , Up: dynamic arrays   [Index]


40.7 Filtering in dynamic arrays

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

Function: dynamic-array-filter dst-arry pred src-arry
Function: $dynamic-array-filter dst-arry pred src-arry

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

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

Function: dynamic-array-partition match-arry no-match-arry pred src-arry
Function: $dynamic-array-partition match-arry no-match-arry pred src-arry

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

The arguments match-arry and no-match-arry allow us to build and configure dynamic arrays with the needed parameters.