spectomic icon indicating copy to clipboard operation
spectomic copied to clipboard

Adding extra predicates 100 tries error.

Open ghost opened this issue 2 years ago • 1 comments

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!

ghost avatar Jan 25 '23 22:01 ghost

Well, chalk another one up to the folks at Cognitect. This was no problem after RTFM and using a with-gen. Cheers!

ghost avatar Jan 26 '23 15:01 ghost