Spec coll-of kind does not accept a spec as I understand it

According to the documentation :kind can be a “spec”:

:kind - a predicate or spec that the incoming collection must satisfy, such as vector?

The following works as expected:

(s/valid? (s/coll-of string? :kind vector?) ["one" "two" "three"])  

However, given the following:

(s/def ::vector vector?)

this returns false

(s/valid? (s/coll-of string? :kind ::vector) ["one" "two" "three"]).

BTW, this works too:

(s/valid? (s/coll-of string? :kind #(s/valid? ::vector %)) ["one" "two" "three"])
1 Like

Currently it will only take a predicate (despite the doc string). This is logged at https://dev.clojure.org/jira/browse/CLJ-2111

1 Like


I’m very sorry I wasted your time, given this was already logged as an issue.

I spent probably 30 min. searching issues without finding it.

No worries… I know where all the bodies are buried. :slight_smile: