just some doc fixes to make it easier to get started #1

Merged
1 commit merged into from Jan 10, 2011

Conversation

Projects
None yet
2 participants
Contributor

mwotton commented Jan 5, 2011

nice to see a semi-actively-maintained quickcheck-alike in ruby again, even if it is explicitly impure:)

Owner

hayeah commented Jan 10, 2011

hey mark, i fixed the doc to reflect some of the helpers you can use:

Rantly { integer } # => 10
Rantly(3) { integer } # => [301,4109401,12399] # or whatever

Contributor

mwotton commented Jan 10, 2011

Terrific, that looks much better.
I still need to work out how to write a generator that makes arbitrary hashes, but that can wait for another day. Thanks!

Owner

hayeah commented Jan 10, 2011

Rantly { dict { [string,integer] }}
{"bR\qHn"=>247003509502595457,
"-Mp '."=>653206579583741142,
"gY%<SV"=>-888111605212388599,
"+SMn:r"=>-1159506450084197716,
"^3gYfQ"=>-2154064981943219558,
"= :/,"=>433790301059833691}

it can be implemented with a one-liner

def dict(n,&block)
array(n,&block).inject({}) {|h,(k,v)| h[k] = v; h }
end

But that doesn't check for uniqueness of key. So I did another version that uses guard to retry if the generated key had been used.

Contributor

mwotton commented Jan 11, 2011

hah, lovely. thank you.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment