spectomic
spectomic copied to clipboard
Adding extra predicates 100 tries error.
I'm not really sure if it's worth the trouble to do something about this, but I thought I'd report it since it is somewhat normal usage. I've worked around it by writing the spec less generically and using more of them, but I've got a spec described as;
(s/def :dp.attr/dt-kw (s/and :dp.attr/keyword #(kw-in-ns-hierarchy? % "dp.dt")))
Where the predicate function is,
(defn kw-in-ns-hierarchy? "Takes a keyword and a partial or complete namespace and responds true if the keyword is in the hierarchy." [kw, ns-partial-string] (clojure.string/starts-with? (namespace kw) ns-partial-string))
Meaning the keyword could be anything that starts with :dp.dt. This blows up the generation stage.
=> Execution error (ExceptionInfo) at provisdom.spectomic.core/find-type-via-generation$fn (core.clj:79). Couldn't satisfy such-that predicate after 100 tries.
This may be a hard limitation, no biggie over here. Just thought you should know. I'm enjoying having the library in my workflow. Thanks for sharing!
Well, chalk another one up to the folks at Cognitect. This was no problem after RTFM and using a with-gen. Cheers!