test-check 2022-10-21

SELF-SOLVED Ha! My question had its own answer in it 🙂 It may not be stylish, but (tgen/fmap #(apply list %) (tgen/tuple …)) works. Hello test.checkers: I have a successful tgen/tuple generator, but it produces vectors and i want to produce lists. The following does not work: (tgen/fmap list (tgen/tuple …)) . I’m not surprised because the appropriate postprocessing would be something like (apply list (tgen/generate (tgen/tuple …))), but I don’t want to exit the generators via something like tgen/generate and then produce a list, I want a generator that produces a tuple-like list. I’d be grateful for advice!

Alex Miller (Clojure team) 2022-10-21T19:44:55.452739Z

does list* work?

Or just comp apply list

Alex Miller (Clojure team) 2022-10-21T19:46:07.191009Z

there's not many good times to use list*, but this is maybe one of them

you guys are fast :)

list* creates seqs 🤷

my installation can’t find list* in either test.check.generators or in spec.gen.alpha

but #(apply list #) works; (comp apply list) doesn’t quite because it only passes one arg to apply

clojure.core/list*

👍 1

list* is sort of comp apply cons if cons did that

list* seems stylish to me because it’s shorter than #(apply list %). The resulting seq is ok for my needs.