Closed pete-ts closed 4 years ago
@pete-ts sorry for delay reviewing. Code looks good but I spotted some missing license info - the examples and the docs are unlicensed and Gen.char.upper
has an Author
but no license. I'll fix this up when merging but just need your consent to do so, can you just reply and say: "I agree to license all the definitions listed in this PR with the MIT license", then I'll merge and fix things up.
Thanks!
"I agree to license all the definitions listed in this PR with the MIT license"
Okay, great! I merged in 8c92abcb which is Unison hash jhvodutal8ee1mf
A couple comments:
Gen.append : '{Gen} a -> '{Gen} a -> '{Gen} a
and used that in one place, get.Char.alpha
but there might be some other places that could use it instead of assigning a cost
to the thing you want to appear second (which is somewhat fragile).view
to check out the source.@
to reference the function directly. Example below for the Gen.append
docs: test.v1.Gen.append.doc : Doc
test.v1.Gen.append.doc =
[:
`@Gen.append g1 g2` generates all values in `g1` then `g2`, for example:
@[source] examples.ex1
↳ @[evaluate] examples.ex1
When sampling from the resulting generator, if the number of samples is less than the number of
samples needed to exhaust the first generator, the second generator is not consulted, for example:
@[source] examples.ex2
↳ @[evaluate] examples.ex2
:]
Renders as:
`Gen.append g1 g2` generates all values in `g1` then `g2`, for example:
test.v1.Gen.append.examples.ex1 = v1.sample 10 <| Gen.append (natIn 0 3) (natIn 3 5)
↳ [0, 1, 2, 3, 4]
When sampling from the resulting generator, if the number of samples is less than the number of samples
needed to exhaust the first generator, the second generator is not consulted, for example:
test.v1.Gen.append.examples.ex2 = v1.sample 3 <| Gen.append (natIn 0 4) (natIn 100 130)
↳ [0, 1, 2]
Overview
This
unison pull request
aims to addGenerators
in thebase.test.v1.Char
namespace.All functions have documentation linked, as well as author and license. In lieu of test cases, the documentation contains the exhausted
source
'd outputs of each generatorCode review
Added definitions: