I was experimenting with custom function generators in order to support the scenario describe in spec guide https://clojure.org/guides/spec#_combining_check_and_instrument but with the goal of making the generated values depend on the concrete arguments and not only on the :ret spec.
While working on that, I noticed a weird behavior that I fail to understand where a generated function is being called 21 times before actually being returned.
(require '[clojure.spec.alpha :as s]
'[clojure.spec.gen.alpha :as gen])
:args (s/cat :x int?)
(fn [& argv]
(gen/generate (s/gen string?)))))
(gen/generate (s/gen `foo))
;; Returns: #function[fspec-gen-bug.core/fn--6577/fn--6578]
This behavior seems specific to function generation for example
(s/spec (s/coll-of int?)
(doto [(gen/generate (s/gen int?))]
(gen/generate (s/gen ::bar))
;; Returns: 
Is there a good reason why generated functions are invoked eagerly ? or is it a bug ?