test-check

Brian Beckman 2022-10-21T19:41:45.408379Z

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?

2022-10-21T19:45:41.253019Z

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

Brian Beckman 2022-10-21T19:46:07.423969Z

you guys are fast :)

2022-10-21T19:46:12.091179Z

list* creates seqs 🤷

Brian Beckman 2022-10-21T19:48:09.184299Z

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

Brian Beckman 2022-10-21T19:48:25.671649Z

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

2022-10-21T19:48:45.466449Z

clojure.core/list*

👍 1
2022-10-21T19:50:26.070629Z

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

Brian Beckman 2022-10-21T19:55:49.294869Z

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