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


38.8 Converting deques to other objects

The following syntactic bindings are exported by the library (vicare containers deques). The syntactic bindings whose name is prefixed with $ are unsafe operations: they do not validate their arguments before accessing them.

Function: deque->list deque
Function: $deque->list deque
Function: list->deque list
Function: $list->deque list

Convert to and from a deque and a proper list. Objects from the list are pushed on the deque left–to–right from the rear side.

(define D
  (list->deque '(0 1 2)))

(deque-front D)         ⇒ 0
(deque-rear  D)         ⇒ 2
(deque->list D)         ⇒ (0 1 2)
Function: deque->vector deque
Function: $deque->vector deque
Function: vector->deque vector
Function: $vector->deque vector

Convert to and from a deque and a vector. Objects from the vector are pushed on the deque left–to–right from the rear side.

(define D
  (vector->deque '#(0 1 2)))

(deque-front   D)       ⇒ 0
(deque-rear    D)       ⇒ 2
(deque->vector D)       ⇒ #(0 1 2)