Next: , Up: iteration thunks   [Index]


22.1 Iterators for common objects

The following syntactic bindings are exported by the library (vicare containers iteration-thunks).

Function: make-list-iteration-thunk ell

Return an iteration thunk for the objects in the proper list ell.

(define (xcons a b)
  (cons b a))

(iteration-thunk-fold xcons
  '()
  (make-list-iteration-thunk '(0 1 2 3 4)))
⇒ (4 3 2 1 0)
Function: make-spine-iteration-thunk ell

Return an iteration thunk for the pairs in the proper list ell.

(define (kons knil pair)
  (cons (car pair) knil))

(iteration-thunk-fold kons
  '()
  (make-list-iteration-thunk '(0 1 2 3 4)))
⇒ (4 3 2 1 0)
Function: make-vector-iteration-thunk vec

Return an iteration thunk for the objects in the vector vec.

(define (xcons a b)
  (cons b a))

(iteration-thunk-fold xcons
  '()
  (make-vector-iteration-thunk '#(0 1 2 3 4)))
⇒ (4 3 2 1 0)
Function: make-string-iteration-thunk str

Return an iteration thunk for the characters in the string str.

(define (xcons a b)
  (cons b a))

(iteration-thunk-fold xcons
  '()
  (make-string-iteration-thunk "01234"))
⇒ (#\4 #\3 #\2 #\1 #\0)
Function: make-bytevector-u8-iteration-thunk bv

Return an iteration thunk for the octets in the bytevector bv.

(define (xcons a b)
  (cons b a))

(iteration-thunk-fold xcons
  '()
  (make-bytevector-u8-iteration-thunk '#vu8(0 1 2 3 4)))
⇒ (4 3 2 1 0)
Function: make-bytevector-s8-iteration-thunk bv

Return an iteration thunk for the bytes in the bytevector bv.

(define (xcons a b)
  (cons b a))

(iteration-thunk-fold xcons
  '()
  (make-bytevector-s8-iteration-thunk '#vs8(0 -1 -2 -3 -4)))
⇒ (-4 -3 -2 -1 0)

Next: , Up: iteration thunks   [Index]