Created
December 11, 2013 06:56
-
-
Save timvw/7906093 to your computer and use it in GitHub Desktop.
Cards
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
type Suit = | |
| Spades | |
| Hearts | |
| Diamonds | |
| Clubs | |
type Rank = | |
| Ace | |
| King | |
| Queen | |
| Jack | |
| Number of int | |
type Card = { | |
Suit : Suit | |
Rank : Rank | |
} | |
let suits = [Spades; Hearts; Diamonds; Clubs] | |
let ranks = ([2..10] |> List.map (fun n -> Number n)) @ [Jack; Queen; King; Ace] | |
let deck = | |
suits | |
|> List.collect (fun suit -> | |
ranks |> List.map (fun rank -> { Suit = suit; Rank = rank; })) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment