Next: , Up: deques   [Index]

38.1 Deque objects

Deques are implemented as doubly–linked lists of vector objects; each vector acts as buffer for contained objects; all the vectors have the same length.

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

R6RS Record Type: <deque>

Record type representing a deque object. The <deque> type is non–generative and available for subtyping. In this documentation <deque> object arguments to functions are indicated as deque.

Function: make-deque
Function: make-deque buffer-length

Build and return a new <deque> object. The optional argument buffer-length must be a non–negative fixnum representing the number of slots in the internal object buffers; when not given, it defaults to 15.

Function: deque? obj

Return #t if obj is a record of type <deque>; otherwise return #f.

Function: deque obj

Build and return a <deque> object holding the given objects, which are pushed on the deque left to right from the rear side. The size of the internal buffers is set to the default.

(define D
  (deque 0 1 2))

(deque-front D)         ⇒ 0
(deque-rear  D)         ⇒ 2

Object properties

Function: deque-putprop deque key value
Function: $deque-putprop deque key value

Add a new property key to the property list of deque; key must be a symbol. If key is already set: the old entry is mutated to reference the new value.

Function: deque-getprop deque key
Function: $deque-getprop deque key

Return the value of the property key in the property list of deque; if key is not set: return #f. key must be a symbol.

Function: deque-remprop deque key
Function: $deque-remprop deque key

Remove the property key from the property list of deque; if key is not set: nothing happens. key must be a symbol.

Function: deque-property-list deque
Function: $deque-property-list deque

Return a new association list representing the property list of deque. The order of the entries is the same as the property creation order.

Other operations

Function: deque-hash deque
Function: $deque-hash deque

Return an exact integer to be used as hashtable key for deque. Hashtables having a <deque> as key can be instantiated as follows:

(make-hashtable deque-hash eq?)

Next: , Up: deques   [Index]