5.5 Vector Handling Functions
TBoS p.85-95, SD
Pattern-matchng over vectors works when the vector is fully populated.
Trying to access an element in an index which has not been assigned a value raises
an error. Note vector destructuring in this way is slow and the facility is not often used.
This example non-destructively double every element in a vector.
(define vector-double
<> -> <>
(@v X V) -> (@v (+ X X) (vector-double V)))
vector-double
(vector-double (@v 1 2 3 <>))
<2 4 6>
|
|