In your answer with with gen/one-of, you repeated keyword? which was the main predicate. In that case you repeated the main predicate twice, once for defining the validity, once in the definition of the generator. Can we avoid this repetition?
I think it is a common pattern to give some examples to a generator for documentation, but it reduce the power for testing.
Recursive specs? I’ve tried all old examples I’ve found, but they don’t seem to work (any longer?). In spec or spec2, are recursive specs possible, or is eager lookup making it impossible? I mean things like this:
(def ex '(+ (+ 1 (* 2 3)) 200))
(defn operator? [x] (#{'+ '- '* '/} x))
(s/def ::operator operator?)
(s/def ::operand int?)
;; I've tried many different ways, but fail to get something like this working
(s/def ::expr
(s/or :operand ::operand
:expr (s/cat :operator ::operator
:left ::expr
:right ::expr))