|(require data/pvector)||package: pvector|
This provides an implementation of persistent, immutable vectors. They are implemented as 32-way bitmapped tries with a tail to provide truly constant time appends to the end of the vector. Data is shared between a vector and its subsequent functional modifications.
The persistent vectors provided by this module implement the gen:equal+hash generic interface, so they may be used as keys, and equal? will perform deep comparisons. Additionally, they implement three interfaces from data/collection, gen:countable, gen:collection, and gen:sequence, which contain the interface for interacting with them.
> (pvector 1 2 3 4)
#pv[1 2 3 4]
Afterwards, they can be interacted with via the functions from data/collection.
It is often useful to create an empty vector using (pvector), then extending it with some other sequence.
> (extend (pvector) (take 10 (in-naturals)))
#pv[0 1 2 3 4 5 6 7 8 9]
n : exact-nonnegative-integer? proc : (exact-nonnegative-integer? . -> . any/c)
(for/pvector (for-clause ...) body-or-break ... body)
(for*/pvector (for-clause ...) body-or-break ... body)