Fork me on GitHub

Can't speak to intention, but that predicate has an invariant assumption: that the arg is a collection. Neither true nor false would be valid answers. The error can be avoided by first checking that the invariant assumption holds:

user=> (s/valid? (s/and coll? empty?) 1)


Is it possible to dynamically generate specs at runtime? For example, based on a runtime value, I call a fn that returns a vector of namespaced keys. I then generate a spec like (s/keys :req vector-of-keys). Since keys is a macro, I haven’t been able to find a way

Alex Miller (Clojure team)14:09:51

you'll need to eval somehow, either by explicitly using eval or by wrapping in another macro that uses backtick

Alex Miller (Clojure team)14:09:11

(in spec 2, we've made this much easier)


Great, looking forward to spec2