test-check

nberger 2017-04-16T02:06:26.449742Z

@jfntn one way is using gen/let:

(defn gen-with-index-and-count-using-let
    "Return a generator that will return tuples of:
    [<value from coll-gen>
    [<valid index in coll>
    <count within bounds of index to end of coll>]."
    [coll-gen]
    (gen/let [coll coll-gen
              index (gen/choose 0 (max 0 (dec (count coll))))
              bounded-count (gen/choose 0 (- (count coll) index))]
      [coll [index bounded-count]]))

nberger 2017-04-16T02:08:57.456658Z

makes it much easier to read to my eyes 🙂

jfntn 2017-04-16T05:02:18.917519Z

Ooh monads 😄 very nice, didn’t know about this let, thank you

nberger 2017-04-16T18:02:59.135940Z

Hehe yeah, it's a macro that takes those bindings and transform them to use gen/bind so it's probably generating something similar to your original generator