Next: chains filtering, Previous: chains mapping, Up: chains [Index]
The following syntactic bindings are exported by the library
(vicare containers chains). The bindings whose name is prefixed
with $ are unsafe operations: they do not validate their
arguments before accessing them.
Apply the procedure fun over the chain arguments; stop at the
first application returning #f and return #f. If the
iteration reaches the end of one argument: the last procedure
application is performed in tail position, so its return value is the
return value of the iteration; if one of the arguments is null: the
return value is #t. The iteration starts from the link given as
argument, then it proceeds in the forwards direction; the iteration
stops when reaching the end of one of the chain arguments.
Apply the procedure fun over the chain arguments; stop at the
first application returning true and return the returned value. If the
iteration reaches the end of one argument: the last procedure
application is performed in tail position, so its return value is the
return value of the iteration; if one of the arguments is null: the
return value is #f. The iteration starts from the link given as
argument, then it proceeds in the forwards direction; the iteration
stops when reaching the end of one of the chain arguments.
Apply the procedure fun to the objects in chain: stop at the first true value and return the object from chain that generated it.
When not-found-rv is not used: if all the applications return
#f, the return value is #f.
When not-found-rv is used: if all the applications return
#f, the return value is not-found-rv.
The iteration starts from the link given as argument, then it proceeds in the forwards direction; the iteration stops when reaching the end of one of the chain arguments.
(chain-find-forwards
even?
(chain 1 3 5 7)
'not-found)
⇒ not-found
(chain-find-forwards
even?
(chain 1 3 5 7))
⇒ #f
(chain-find-forwards
even?
(chain 1 3 5 6 7)
'not-found)
⇒ 6
Next: chains filtering, Previous: chains mapping, Up: chains [Index]