This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

## 2019-02-11

## Channels

- # adventofcode (8)
- # announcements (1)
- # arachne (23)
- # beginners (146)
- # boot (4)
- # calva (2)
- # cider (48)
- # cljs-dev (17)
- # clojure (214)
- # clojure-austin (2)
- # clojure-berlin (1)
- # clojure-europe (9)
- # clojure-italy (5)
- # clojure-nl (2)
- # clojure-sanfrancisco (2)
- # clojure-spec (124)
- # clojure-uk (67)
- # clojured (3)
- # clojurescript (95)
- # community-development (7)
- # cursive (68)
- # data-science (1)
- # datomic (80)
- # emacs (19)
- # figwheel (3)
- # figwheel-main (5)
- # fulcro (61)
- # javascript (2)
- # kaocha (1)
- # off-topic (25)
- # pathom (21)
- # pedestal (1)
- # perun (4)
- # reitit (11)
- # ring-swagger (2)
- # shadow-cljs (55)
- # spacemacs (4)
- # sql (8)
- # test-check (16)
- # tools-deps (2)
- # vim (13)
- # yada (4)

hi, is it possible to make a generator from a custom lazy sequence? For practice, I was trying to use test-check to test FizzBuzz problem - I want a generator that returns multiples of 3 but not of 5 or 15

gen/such-that would suffice here for casual use

Give it a higher max-tries, like 100

it’s help to invert your thinking for stuff like this

generate a number, then use fmap to multiply by 3 so you always generate multiples of 3

could then use such-that over that to exclude multiples of 5 if needed

Ok I had tried `generate a number, then use fmap to multiply by 3 so you always generate multiples of 3`

but didn't apply such-that to exclude multiples of 5, let me try, thank you for all replies!

yeah I forgot to say the multiply part

you could *still* use such-that without multiplying, it'd just be even slower and you'd probable need an even higher max-tries

if you want to be fancy you can use some number theory to generate a good distribution of such numbers w/o filtering

you could gen a set of non-5 numbers, then multiply all of them and by 3 to generate only numbers divisible by 3 but not 5 :)

@alexmiller that's just moving the filtering to the first generator, right?

the fancy thing I have in mind is basically `(gen/let [fifteens gen/int, threes (gen/choose 1 4)] (+ (* 15 fifteens) (* 3 threes)))`

I *think* that'd work