Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
214 views
in Technique[技术] by (71.8m points)

Call to clojure.core/fn did not conform to spec


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The problem is the -> macro you are using which inserts the threading value in the first position, right after the fn symbol. So this:

(map #(-> % int
          (- 48)
          (fn [x] (* x x))))

becomes something like:

(map #(fn
        (- (int %) 48)
        [x]
        (* x x)))

That is obviously invalid because fn expects the first arg to be a vector of function parameters, which is what the error message is trying to say:

fails spec: :clojure.core.specs.alpha/arg-list at: [:args :bs :arity-1 :args] predicate: vector?

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...