Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification of concepts #8

Open
lionel- opened this issue Feb 9, 2018 · 2 comments
Open

Clarification of concepts #8

lionel- opened this issue Feb 9, 2018 · 2 comments

Comments

@lionel-
Copy link

lionel- commented Feb 9, 2018

"shrink" is not defined in the README which makes it harder for newcomers to understand the package.

It seems that there are two big aspects in the package, generation of data and iteration over data. Also monads and currying seem to play a role. (Altough it seems what you're calling currying is just argument application). It is a bit nebulous how these aspects work (independently and together).

In general I think any solution involving monads and currying is not going to feel R-like so it /might/ be worth exploring other approaches, if possible at all. See also the flowery package for some experiments on iterators as R functions, which perhaps is relevant https://github.com/lionel-/flowery.

@HuwCampbell
Copy link
Member

Hi.

Shrink has the usual meaning, just to make smaller. Quickcheck style libraries is build up large random values for testing. Without shrinking them it can be quite hard to interpret what's actually causing the bug, as the signal to noise ration can be high. Shrinking allows one to see the most pertinent causes of bugs.

As for gens being monads, if one isn't aware of the concept they shouldn't worry too much. I'm just stating that one can make a generator using the output of another generator.

Thanks for the heads up about flowery. I appreciate your iterate function's handling of quasi for loops for this purpose; it's interesting (and kind of insane in its implementation), but seems to provide something clean for the end user.

@HuwCampbell
Copy link
Member

HuwCampbell commented Feb 25, 2018

I have managed to port over a function which acts similarly.

gen_squares   <- generate(for (i in gen.int(10)) i^2)
gen_sq_digits <- generate(for (i in gen_squares) {
  gen.c(of = i, gen.element(1:9))
})

which is kind of cool.

Edit: I would note, it's actually just sugar on and_then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants