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


47.4 Chains as queues

The library (vicare containers iqueues chains) provides a concrete implementation of the <iqueue> 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 iqueues)
  (vicare containers iqueues chains))

(define S
  (make-iqueue-chain (chain)))

(iqueue-push! S 0)
(iqueue-push! S 1)
(iqueue-push! S 2)

(iqueue-top  S)         ⇒ 2
(iqueue-pop! S)         ⇒ 2
(iqueue-pop! S)         ⇒ 1

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

Record Type: <iqueue-chain>

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

Function: make-iqueue-chain chain

Build and return a new instance of <iqueue-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: iqueue-chain? obj

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

Function: iqueue-chain-first-link iqueue

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

Function: iqueue-chain-last-link iqueue

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