传递的参数数量错误

时间:2013-06-30 03:11:30

标签: exception clojure arguments

(defn make-heavy [f] 
  (fn [& args]
    (Thread/sleep 1000)
    (apply f args)))

(defn doRunThroughSplit [vector NoOfLines]
;the function is too long

(def zzz [34877 30287 18160 22981])

它们是4行文件的行数

(time (def abc (map (make-heavy doRunThroughSplit [x1 n1 m1 b1] zzz))))

似乎我继续得到这个例外,我不明白为什么

ArityException Wrong number of args (3) passed to: final$make-heavy clojure.lang.AFn.throwArity (AFn.java:437)

make heavy function实际上是从实际的clojure中复制而来的。

1 个答案:

答案 0 :(得分:2)

可以想象这就是你想要的:

(defn make-heavy [f] (fn [& args] (Thread/sleep 1000) (apply f args)))

(defn doRunThroughSplit [NoOfLines] (println "noOfLines=" NoOfLines))

(def zzz [34877 30287 18160 22981])

(time (def abc (map (make-heavy doRunThroughSplit) zzz)))
相关问题