A
persistent vector differs from an ordinary vector (
Vectors ) in that it is immutable, and all operations yield new persistent vectors instead of modifying inputs. Unlike immutable operations on ordinary sequences, persistent vector operations are efficient and run in sub-linear time.
The class of persistent vectors:
persistent-vector
Converting a sequence into a persistent vector:
>persistent-vector ( seq -- pvec )
Persistent vectors have a literal syntax:
PV{
The empty persistent vector, written
PV{ }, is used for building up all other persistent vectors.
This implementation of persistent vectors is based on the
clojure.lang.PersistentVector class from Rich Hickey's Clojure language for the JVM (
http://clojure.org).