[racket] Immutable vectors

From: Konrad Hinsen (konrad.hinsen at fastmail.net)
Date: Wed Sep 4 12:28:08 EDT 2013

For the kind of data I am working with, immutable vectors look like
just the right choice: immutable and O(1) element access. However, I
am discovering that they are a real pain to work with.

Pretty much any vector operation returns a mutable vector: vector-map,
vector-drop, vector-split-at, etc. I have to use
vector->immutable-vector afterwards to get what I want.  That's a lot
of code clutter, and a lot of unnecessary object generation.
Getting data from a stream into an immutable vector is the worst: it
requires two intermediates: sequence->list, list->vector,
vector->immutable-vector.

So I am beginning to wonder if immutable vectors are some obsolete
feature that is being discouraged. Is there a better choice for an
immutable sequence with O(1) element access?

Konrad.

Posted on the users mailing list.