Last active
April 15, 2016 19:16
-
-
Save monkieboy/0479320280f40b6d67c333ab76575e71 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let genHand : Gen<Hand> = | |
let deck = | |
gen { | |
let! seed = Gen.choose (0, 100000) | |
let deck = shuffle newDeck seed | |
return deck } | |
gen { | |
let! (ShuffledDeck d) = deck | |
let hand = | |
d | |
|> List.take 5 | |
return hand } | |
// Shorter | |
let genHand : Gen<Hand> = | |
gen { | |
let! seed = Gen.choose (0, 100000) | |
let deck = shuffle newDeck seed | |
let (ShuffledDeck d) = deck | |
return d |> List.take 5 } | |
// Even shorter :-) | |
let genHand : Gen<Hand> = | |
gen { | |
let! seed = Gen.choose (0, 100000) | |
let (ShuffledDeck deck) = shuffle newDeck seed | |
return deck |> List.take 5 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment