You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each would take a non-negative integer and produce a list of strictly positive integers that sum to that integer. genPartition would generate partitions of all sizes; breakInN would take an argument indicating the desired length of the result list, and would fail if asked to produce an empty list or one that's too long.
Why for? Suppose you want to generate something like Data.Tree.Tree. The currently-available tools make it very hard to both
Avoid producing a bunch of trivial trees.
Avoid ever producing an utterly enormous tree.
With genPartition, you can produce a partition of the desired size, which determines the number of trees in the subforest and how large each of them should be.
Digging around online, I found this algorithm, but unfortunately I don't know enough to fully understand it, let alone implement it for Hedgehog.
The text was updated successfully, but these errors were encountered:
This would be pretty awesome, I've thought a lot about trying to generate random programs and I can see this being related to the issues you see there.
When producing certain sorts of recursive structures, it would be very useful to have functions like
Each would take a non-negative integer and produce a list of strictly positive integers that sum to that integer.
genPartition
would generate partitions of all sizes;breakInN
would take an argument indicating the desired length of the result list, and would fail if asked to produce an empty list or one that's too long.Why for? Suppose you want to generate something like
Data.Tree.Tree
. The currently-available tools make it very hard to bothWith
genPartition
, you can produce a partition of the desired size, which determines the number of trees in the subforest and how large each of them should be.Digging around online, I found this algorithm, but unfortunately I don't know enough to fully understand it, let alone implement it for Hedgehog.
The text was updated successfully, but these errors were encountered: