EvenStevens
March 22nd, 2009, 11:52 PM
I've got an enumerated type "suit" and an enumerated type "rank", then a data type Card which has the fields of suit and rank...
data Card = Card Suit Rank
and now I need to list out all the cards in order, so ace of clubs, two of clubs etc. king of spades, with the function...
deck :: [Card]
And I have no clue... I've tried everything
I tried something like
deck::[Card]
deck = [Card(x,y) | x <- [Ace .. King], y <- [Club .. Spade]]
but alas, parse error :-(
Halp?
data Card = Card Suit Rank
and now I need to list out all the cards in order, so ace of clubs, two of clubs etc. king of spades, with the function...
deck :: [Card]
And I have no clue... I've tried everything
I tried something like
deck::[Card]
deck = [Card(x,y) | x <- [Ace .. King], y <- [Club .. Spade]]
but alas, parse error :-(
Halp?