A Clojure Story - Collections (Vectors)
Vectors are another data structures from the clojure collections. They are indexed and are surrounded by [] brackets and unlike lists
they do not need to be quoted.
Important to note that:
Vector operations⌗
They are unlike Lists which are sequential, Vectors are both sequential and randomly accessible.
Just like Lists, first
second
and nth
work for vectors too.
Vectors support rseq
, get
And common collection functions like last
, count
, rest
, next
Wait, whats the difference between rest
and next
they both seem to do the same thing. The difference lies when there is only single element in the vector/list.
In the next post I will be picking up on yet another collection type in clojure i.e: SETS