Skip to content

Instantly share code, notes, and snippets.

@monkieboy
Last active Apr 15, 2016
Embed
What would you like to do?
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