Next: , Previous: , Up: ideques   [Index]


48.3 Chains as deques

The library (vicare containers ideques chains) provides a concrete implementation of the <ideque> type using a chain as storage; chains are defined by the library (vicare containers chains), Chains of objects. Usage example:

(import (vicare)
  (vicare containers chains)
  (vicare containers ideques)
  (vicare containers ideques chains))

(define S
  (make-ideque-chain (chain)))

(ideque-push-front! S 0)
(ideque-push-rear!  S 1)

(ideque-front S)        ⇒ 0
(ideque-rear  S)        ⇒ 1
(ideque-pop-front! S)   ⇒ 0
(ideque-pop-rear!  S)   ⇒ 1

The following syntactic bindings are exported by the library (vicare containers ideques chains).

Record Type: <ideque-chain>

Record type implementing an <ideque>, of which it is a subtype.

Function: make-ideque-chain chain

Build and return a new instance of <ideque-chain>. The argument chain must be null or an instance of type <chain-link> as defined by the library (vicare containers chains); this function automatically determines the first and last links in the chain starting from chain.

Function: ideque-chain? obj

Return #t if obj is an instance of <ideque-chain>; otherwise return #f.

Function: ideque-chain-first-link ideque

Return null or the first link of the chain used as storage in the <ideque-chain> instance ideque.

Function: ideque-chain-last-link ideque

Return null or the last link of the chain used as storage in the <ideque-chain> instance ideque.