Re: Recursive specs & forward declarations

2017-01-02 Thread John Schmidt
Ahh, thanks for the heads up! This is the minimal failing example I could come up with extracted from a larger spec. In the original spec both ::a and ::b contain several other keys with with simple predicates like string?, pos-int? etc. FWIW, adding some additional keys like this to ::a and ::

Re: Recursive specs & forward declarations

2017-01-01 Thread Alex Miller
FYI, s/fdef takes a qualified symbol, not a keyword, and it should refer to a function of the same qualified name. But you could do this instead to address that: (s/def ::a-fn (s/fspec :args (s/cat :arg ::a) :ret ::a)) How could this even generate anything? That is, what would you exp

Re: Recursive specs & forward declarations

2017-01-01 Thread John Schmidt
I just ran in to a similar issue: - (require '[clojure.spec :as s]) (s/def ::a (s/keys :req [::b])) (s/fdef ::a-fn :args (s/cat :arg ::a) :ret ::a) (s/def ::b (s/keys :req [::a-fn])) ;; All of these fail even with s/*recursion-limit* bound to 1. (s/exercise ::

Recursive specs & forward declarations

2016-07-01 Thread Maarten Truyens
Hi, I am struggling with recursive Spec declarations, more in particular how two Spec definitions can refer to each other. In the example below, I use a "forward" declaration, but that does not seem very elegant. Am I missing something? The more fundamental question, however, is how to imple