Fork me on GitHub
#test-check
<
2022-10-21
>
Brian Beckman19:10:45

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!

hiredman19:10:41

Or just comp apply list

Alex Miller (Clojure team)19:10:07

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

Brian Beckman19:10:07

you guys are fast :)

hiredman19:10:12

list* creates seqs 🤷

Brian Beckman19:10:09

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

Brian Beckman19:10:25

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

hiredman19:10:45

clojure.core/list*

👍 1
hiredman19:10:26

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

Brian Beckman19:10:49

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