clojure-spec

nikolavojicic 2025-02-19T08:42:32.738699Z

Is it possible to override generator for fdef, e.g. when instrument+`:stub`, so that ret generator depends on args generator?

(defn ranged-rand
  [start end]
  (+ start (long (rand (- end start)))))

(defn start=start? [{:keys [args  ret]}] (>= ret (:start args)))
(defn ret=start? ret
If not, how to make :stub work when the fdef has :fn which almost always fails?

nikolavojicic 2025-02-23T11:44:56.819639Z

This is possible with :replace instead of :stub.