Next: chains mapping, Previous: chains ops, 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.
Perform a fold-left style iteration over the objects in
chain. The iteration starts at chain and proceeds forwards.
(chain-fold-left-forwards
(lambda (knil obj)
(cons obj knil))
'()
(chain 0 1 2 3 4))
⇒ (4 3 2 1 0)
(chain-fold-left-forwards
(lambda (knil obj)
(cons obj knil))
'()
(chain-link-next
(chain-link-next
(chain 0 1 2 3 4))))
⇒ (4 3 2)
Perform a fold-right style iteration over the objects in
chain. The iteration starts at the last link in the forwards
direction and proceeds up to and including chain.
(chain-fold-right-forwards
(lambda (obj knil)
(cons obj knil))
'()
(chain 0 1 2 3 4))
⇒ (0 1 2 3 4)
(chain-fold-right-forwards
(lambda (obj knil)
(cons obj knil))
'()
(chain-link-next
(chain-link-next
(chain 0 1 2 3 4))))
⇒ (2 3 4)
Perform a fold-left style iteration over the objects in
chain. The iteration starts at chain and proceeds
backwards.
(chain-fold-left-backwards
(lambda (knil obj)
(cons obj knil))
'()
(chain-rear (chain 0 1 2 3 4)))
⇒ (0 1 2 3 4)
(chain-fold-left-backwards
(lambda (knil obj)
(cons obj knil))
'()
(chain-link-prev
(chain-link-prev
(chain-rear (chain 0 1 2 3 4)))))
⇒ (0 1 2)
Perform a fold-right style iteration over the objects in
chain. The iteration starts at the last link in the backwards
direction and proceeds up to and including chain.
(chain-fold-right-backwards (lambda (obj knil)
(cons obj knil))
'()
(chain-rear (chain 0 1 2 3 4)))
⇒ (4 3 2 1 0)
(chain-fold-right-backwards (lambda (obj knil)
(cons obj knil))
'()
(chain-link-prev
(chain-link-prev
(chain-rear (chain 0 1 2 3 4)))))
⇒ (2 1 0)
Next: chains mapping, Previous: chains ops, Up: chains [Index]