test-check 2017-03-02

another thing, suppose I have a bag with a limited number of objects in it per type

at the moment what I'm doing is to generate sequences picking random types and applying constraints to be sure there are never too many of a certain type

I guess there is probably a more efficient way? in theory it's just a random selection in a list, removing the element selected each time

any more idiomatic way to do that with test.check @gfredericks ?

btw it looks like it's not possible to file an issue here https://github.com/clojure/test.check

and there is no mention in the readme about how to do that either

This is mentioned in the readme under Contributing

I don't quite understand the requirements for your bag of limited number of objects question -- it would help if you could share the code you have that does that

It's the link I shared yesterday

Just the usual scrabble bag of letters

Oh so the main constraint is you can't have too many of each letter?

Yes, there is a max quantity for each

And applying constraints would work but I bet it's not really efficient

Do you care about distribution/shrinking?

Maybe I can write my own generator

One idea is to generate a size (gen/nat) and a shuffling of a complete collection of letters, and then fmap with (take size shuffled)

gen/shuffle for doing the shuffling

That still does some throwaway work but it's at least conceptually simple and easy to tweak

And gives you a realistic distribution in a certain sense

ah cool yes I can check

thanks for the idea

writing your own generator would be problematic?

about the issue I wanted to raise, I just wanted to say that now both "generators" and "combinators" are both in the same namespace

and even have the same prefixed name, even if they have two quite different roles from my undertanding

that's all I wanted to mention really

@andrea.crotti what do you mean by "writing your own generator"? I would call what I just described writing your own generator

ah ok but if it's just built using the "official" combinators and generators

does it count as my custom generator?

@andrea.crotti test.check is designed so that you shouldn't need to go beyond those

so we don't usually talk about anything more custom than that

if you have something you think you can't do with the combinators I'd be happy to look at it

@andrea.crotti yep, earlier is better as you say