相关疑难解决方法(0)

为什么clojure的向量函数定义如此冗长?

我真的很想知道为什么vector的实现如此冗长?它不能做的原因是什么[],[a]并且[a & args]

这是我得到的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
Run Code Online (Sandbox Code Playgroud)

clojure

7
推荐指数
1
解决办法
357
查看次数

标签 统计

clojure ×1