Previous: iteration thunks searching, Up: iteration thunks [Index]
The following syntactic bindings are exported by the library
(vicare containers iteration-thunks)
. The syntactic bindings
whose name is prefixed with ‘$’ are unsafe: they do not
validate their arguments.
Iterate over the items from iter, apply pred to them, apply acceptor to the items for which pred returns true. Return unspecified values.
(receive-and-return (ell) '() (iteration-thunk-filter (lambda (rv) (set-cons! ell rv)) even? (make-list-iteration-thunk '(1 3 5 7)))) ⇒ () (receive-and-return (ell) '() (iteration-thunk-filter (lambda (rv) (set-cons! ell rv)) even? (make-list-iteration-thunk '(1 3 4 5 7 8)))) ⇒ (8 4)
Iterate over the items from iter and apply pred to them: if
the return value is true, apply match-acceptor to the item; if the
return value is #f
, apply no-match-acceptor to the item.
Return unspecified values.
(receive-and-return (match-ell no-match-ell) (values '() '()) (iteration-thunk-partition (lambda (match-rv) (set-cons! match-ell match-rv)) (lambda (no-match-rv) (set-cons! no-match-ell no-match-rv)) even? (make-list-iteration-thunk '(1 3 5 7)))) ⇒ () (7 5 3 1) (receive-and-return (match-ell no-match-ell) (values '() '()) (iteration-thunk-partition (lambda (match-rv) (set-cons! match-ell match-rv)) (lambda (no-match-rv) (set-cons! no-match-ell no-match-rv)) even? (make-list-iteration-thunk '(1 3 4 5 7 8)))) ⇒ (8 4) (7 5 3 1)