test-check

2017-03-02T01:26:50.000206Z

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

2017-03-02T09:20:01.000207Z

cool thanks @gfredericks

2017-03-02T09:20:23.000208Z

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

2017-03-02T09:21:09.000209Z

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

2017-03-02T09:21:54.000210Z

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

2017-03-02T09:22:15.000211Z

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

2017-03-02T10:20:38.000212Z

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

2017-03-02T10:20:56.000214Z

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

2017-03-02T14:32:01.000215Z

@andrea.crotti clojure and all the contribs are managed on http://dev.clojure.org/jira

2017-03-02T14:33:01.000216Z

This is mentioned in the readme under Contributing

2017-03-02T14:34:55.000217Z

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

2017-03-02T14:34:58.000218Z

Ah sorry my bad

2017-03-02T14:35:22.000219Z

It's the link I shared yesterday

2017-03-02T14:35:43.000220Z

Just the usual scrabble bag of letters

2017-03-02T14:36:28.000221Z

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

2017-03-02T14:36:46.000222Z

Yes, there is a max quantity for each

2017-03-02T14:37:09.000223Z

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

2017-03-02T14:37:24.000224Z

Do you care about distribution/shrinking?

2017-03-02T14:37:26.000225Z

Maybe I can write my own generator

2017-03-02T14:37:55.000226Z

Potentially yes

2017-03-02T14:39:39.000227Z

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)

2017-03-02T14:40:01.000228Z

gen/shuffle for doing the shuffling

2017-03-02T14:40:58.000229Z

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

2017-03-02T14:41:24.000230Z

And gives you a realistic distribution in a certain sense

2017-03-02T16:06:44.000231Z

ah cool yes I can check

2017-03-02T16:06:50.000232Z

thanks for the idea

2017-03-02T16:07:02.000233Z

writing your own generator would be problematic?

2017-03-02T16:07:43.000234Z

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

2017-03-02T16:08:13.000235Z

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

2017-03-02T16:08:42.000236Z

that's all I wanted to mention really

2017-03-02T16:45:54.000237Z

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

2017-03-02T16:46:46.000238Z

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

2017-03-02T16:46:51.000239Z

does it count as my custom generator?

2017-03-02T16:48:20.000240Z

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

2017-03-02T16:48:35.000241Z

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

2017-03-02T16:52:30.000242Z

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

2017-03-02T17:19:09.000243Z

ok great thanks