Why clojure's vector function definition is so verbose?

Viewed 409

I'm really curious to see why vector's implementation is so verbose? What's the reason it can't just do [], [a] and [a & args]?

Here is what I get from clj-1.4.0.

=> (source vector)
(defn vector
  "Creates a new vector containing the args."
  {:added "1.0"
   :static true}
  ([] [])
  ([a] [a])
  ([a b] [a b])
  ([a b c] [a b c])
  ([a b c d] [a b c d])
  ([a b c d & args]
     (. clojure.lang.LazilyPersistentVector (create (cons a (cons b (cons c (cons d args))))))))
nil
2 Answers
Related