Previous: dynamic arrays sort, Up: dynamic arrays [Index]
Iteration thunks are procedures accepting no arguments and returning an
item from a collection; when the iteration finishes: the return value is
the void object. Iteration thunks can be used with the facilities of
the library (vicare containers iteration-thunks)
(see iteration thunks). The following syntactic bindings are
exported by the library (vicare containers dynamic-arrays).
Build and return a new iteration thunk visiting the objects from the front of arry.
(import (vicare)
(vicare containers dynamic-arrays)
(vicare containers iteration-thunks))
(define (xcons a b)
(cons b a))
(iteration-thunk-fold
xcons
'()
(make-dynamic-array-front-iteration-thunks
(dynamic-array)))
⇒ ()
(iteration-thunk-fold
xcons
'()
(make-dynamic-array-front-iteration-thunks
(dynamic-array 0 1 2 3 4 5)))
⇒ (5 4 3 2 1 0)
Build and return a new iteration thunk popping the objects from the rear of arry.
(import (vicare)
(vicare containers dynamic-arrays)
(vicare containers iteration-thunks))
(define (xcons a b)
(cons b a))
(iteration-thunk-fold
xcons
'()
(make-dynamic-array-rear-iteration-thunks
(dynamic-array)))
⇒ ()
(iteration-thunk-fold
xcons
'()
(make-dynamic-array-rear-iteration-thunks
(dynamic-array 0 1 2 3 4 5)))
⇒ (0 1 2 3 4 5)