Calling concat on vectors returns a list. Being a total noob I would expect that the result would also be a vector. Why the conversion to list?
Example:
user=> (concat [1 2] [3 4] [5 6])
(1 2 3 4 5 6)
; Why not: [1 2 3 4 5 6] ?
concat returns a lazy sequence.
user=> (doc concat)
-------------------------
clojure.core/concat
([] [x] [x y] [x y & zs])
Returns a lazy seq representing the concatenation of the elements in the supplied colls.
you can convert it back to a vector with into:
user=> (into [] (concat [1 2] [3 4] [5 6]))
[1 2 3 4 5 6]
into uses transients so it's pretty quick about it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With