Closed IrSent closed 6 years ago
Right, so this is a pretty common idiom in Clojure. When we compare using =
, [:a, :b :c]
is the same as '(:a :b :c)
, which is the same as (cons :a '(:b :c))
, etc. - even though those are all different concrete types (clojure.lang.PersistentVector
, clojure.lang.PersistentList
, and clojure.lang.Cons
, respectively).
The equality comparison doesn't care about the type, just the values contained in the sequential collection. And vector is a commonly used literal, in part since unlike the list literal, you don't have to worry about quoting.
Using
http://clojurescript.net/
REPL that expression returns an Array(:a :b __ __)
, and not a Vector[:a :b __ __]
as it is stated in the koan(ab-adder [__ __ __ __])
clojure.core/concat documentation
It would be a Vector if we add
into []
: