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


40.3 Dynamic-Arrays accessors and mutators

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-ref arry idx
Function: $dynamic-array-ref arry idx

Return the object at idx in the dynamic array. Raise an assertion violation if arry is empty.

Function: dynamic-array-set! arry idx obj
Function: $dynamic-array-set! arry idx obj

Store a new value at idx in the dynamic array, overwriting the old value.

Function: dynamic-array-insert! arry idx obj
Function: $dynamic-array-insert! arry idx obj

Insert a new value at idx in the dynamic array. The objects in the array are shifted to make room for the new one.

The argument idx must be a non–negative fixnum in the range [0, N) where N is the number of objects in the array; as special cases:

(let ((D (dynamic-array 0 1 2 3)))
  (dynamic-array-insert! D 0 9)
  (dynamic-array->list D))
⇒ (9 0 1 2 3)

(let ((D (dynamic-array 0 1 2 3)))
  (dynamic-array-insert! D 3 9)
  (dynamic-array->list D))
⇒ (0 1 2 9 3)
Function: dynamic-array-remove! arry idx
Function: $dynamic-array-remove! arry idx

Remove the object at index idx in arry.

(let ((D (dynamic-array 0 1 2 3 4)))
  (dynamic-array-remove! D 2)
  (dynamic-array->list D))
⇒ (0 1 3 4)
Function: dynamic-array-front arry
Function: $dynamic-array-front arry

Return the object at the front of the dynamic array. Raise an assertion violation if arry is empty.

Function: dynamic-array-rear arry
Function: $dynamic-array-rear arry

Return the object at the rear of the dynamic array. Raise an assertion violation if arry is empty.

Function: dynamic-array-push-front! arry obj
Function: $dynamic-array-push-front! arry obj

Push obj on the front of arry.

Function: dynamic-array-push-rear! arry obj
Function: $dynamic-array-push-rear! arry obj

Push obj on the rear of arry.

Function: dynamic-array-pop-front! arry
Function: $dynamic-array-pop-front! arry

Remove the object at the front of the dynamic array and return it. Raise an assertion violation if arry is empty.

Function: dynamic-array-pop-rear! arry
Function: $dynamic-array-pop-rear! arry

Remove the object at the rear of the dynamic array and return it. Raise an assertion violation if arry is empty.

Function: dynamic-array-purge! arry
Function: $dynamic-array-purge! arry

Remove all the elements from arry.


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