Next: , Previous: , Up: dynamic arrays   [Index]


40.8 Converting dynamic-arrays to other objects

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

Function: dynamic-array->list arry
Function: $dynamic-array->list arry
Function: list->dynamic-array list
Function: $list->dynamic-array list

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

(define D
  (list->dynamic-array '(0 1 2)))

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

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

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

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