Next: iteration thunks searching, Previous: iteration thunks folding, 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.
Apply fun
to the items from the iteration thunks iter.
When multiple iteration thunks are given: the iteration stops when one
of the thunks returns the sentinel. The function acceptor is
applied to the the results of the applications. The return value of the
mapping form is the return value of the last application of
acceptor; if the iteration thunk is empty: the return value is the
sentinel.
(let ((ell '())) (iteration-thunk-map (lambda (rv) (set-cons! ell rv) ell) - (make-list-iteration-thunk '(0 1 2 3 4)))) ⇒ (-4 -3 -2 -1 0) (let ((ell '())) (iteration-thunk-map (lambda (rv) (set-cons! ell rv) ell) + (make-list-iteration-thunk '(0 1 2 3 4)) (make-list-iteration-thunk '(0 10 20 30 40)))) ⇒ (44 33 22 11 0)
Apply fun
to the items from the iteration thunks iter and
discard the return values. When multiple iteration thunks are given:
the iteration stops when one of the thunks returns the sentinel.
(receive-and-return (ell) '() (iteration-thunk-for-each (lambda (item) (set-cons! ell (- item))) (make-list-iteration-thunk '(0 1 2 3 4)))) ⇒ (-4 -3 -2 -1 0) (receive-and-return (ell) '() (iteration-thunk-for-each (lambda (item1 item2) (set-cons! ell (+ item1 item2))) (make-list-iteration-thunk '(0 1 2 3 4)) (make-list-iteration-thunk '(0 10 20 30 40)))) ⇒ (44 33 22 11 0)
Next: iteration thunks searching, Previous: iteration thunks folding, Up: iteration thunks [Index]