Next: iteration thunks filtering, Previous: iteration thunks mapping, 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.
If all the applications of fun return true: the return value is
#t. If an application of fun returns #f: the iteration
stops immediately and the return value is #f.
(iteration-thunk-for-all
even?
(make-list-iteration-thunk '(2 4 5 6 8)))
⇒ #f
(iteration-thunk-for-all
even?
(make-list-iteration-thunk '(2 4 6 8)))
⇒ #t
(iteration-thunk-for-all
=
(make-list-iteration-thunk '(+1 +2 +3 +4))
(make-list-iteration-thunk '(+1 +2 +3 +4))
(make-list-iteration-thunk '(+1 +2 +3 +4)))
⇒ #t
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.
If all the applications of fun return #f: the return value
is #f. If an application of fun returns a non–#f
value: the iteration stops immediately and the returned value is
returned.
(iteration-thunk-exists
even?
(make-list-iteration-thunk '(1 3 5 7)))
⇒ #f
(iteration-thunk-exists
even?
(make-list-iteration-thunk '(1 3 4 5 7)))
⇒ #t
(iteration-thunk-exists
=
(make-list-iteration-thunk '(+1 +2 +3 +4))
(make-list-iteration-thunk '(-1 -2 +3 -4))
(make-list-iteration-thunk '( 0 0 +3 0)))a
⇒ #t
Apply fun to the items from the iteration thunk iter:
#f and
not-found-handler is not given: the return value is #f.
#f and
not-found-handler is given: not-found-handler must be a
thunk and the return value is the return value of the thunk;
not-found-handler is called in tail position.
#f value: the
iteration stops immediately and the return value is the item from the
iteration thunks.
(iteration-thunk-find
even?
(make-list-iteration-thunk '(1 3 5 7)))
⇒ #f
(iteration-thunk-find
even?
(make-list-iteration-thunk '(1 3 5 7))
(lambda () 'not-found))
⇒ not-found
(iteration-thunk-find
even?
(make-list-iteration-thunk '(1 3 4 5 7)))
⇒ 4
Next: iteration thunks filtering, Previous: iteration thunks mapping, Up: iteration thunks [Index]