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

47.3 Deques as queues

The library (vicare containers iqueues deques) provides a concrete implementation of the <iqueue> type using a deque as storage; deques are defined by the library (vicare containers deques), Double–ended queues of objects. Usage example:

(import (vicare)
  (vicare containers deques)
  (vicare containers iqueues)
  (vicare containers iqueues deques))

(define S
  (make-iqueue-deque (deque)))

(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 deques).

Record Type: <iqueue-deque>

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

Function: make-iqueue-deque deque

Build and return a new instance of <iqueue-deque>. The argument deque must be an instance of type <deque> as defined by the library (vicare containers deques).

Function: iqueue-deque? obj

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