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


40.5 Mapping over dynamic arrays

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-map-left dst-arry fun src-arry
Function: $dynamic-array-map-left dst-arry fun src-arry

Iterate over all the objects in src-arry, starting from the front side, apply fun to them, push the result of the application in the rear side of dst-arry.

(dynamic-array->list
  (dynamic-array-map-left
     (dynamic-array)
     -
     (dynamic-array 0 1 2 3)))
⇒ (0 -1 -2 -3)

The dst-arry argument allows us to build the destination dynamic array with the desired configuration parameters.

Function: dynamic-array-map-right dst-arry fun src-arry
Function: $dynamic-array-map-right dst-arry fun src-arry

Iterate over all the objects in src-arry, starting from the rear side, apply fun to them, push the result of the application in the front side of dst-arry.

(dynamic-array->list
  (dynamic-array-map-right
     (dynamic-array)
     -
     (dynamic-array 0 1 2 3)))
⇒ (0 -1 -2 -3)

The dst-arry argument allows us to build the destination dynamic array with the desired configuration parameters.

Function: dynamic-array-map fun arry
Function: $dynamic-array-map fun arry

Aliases for dynamic-array-map-left and $dynamic-array-map-left.

Function: dynamic-array-for-each-left fun arry
Function: $dynamic-array-for-each-left fun arry

Iterate over all the objects in arry, starting from the front side, and apply fun to them discarding the return value.

Function: dynamic-array-for-each-right fun arry
Function: $dynamic-array-for-each-right fun arry

Iterate over all the objects in arry, starting from the rear side, and apply fun to them discarding the return value.

Function: dynamic-array-for-each fun arry
Function: $dynamic-array-for-each fun arry

Aliases for dynamic-array-for-each-left and $dynamic-array-for-each-left.


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