-- Lecture 2A Part II. Back to Lists data Suit = Hearts | Diamonds | Clubs | Spades deriving (Eq,Show) .data Rank = Numeric Int | Jack | Queen | King | Ace deriving (Eq,Show) data Card = Card {rank::Rank, suit::Suit} deriving (Eq,Show) type Hand = [Card] ------------------------------------------ -- (:) and [] are the contructors: -- the basic building blocks for lists -- Prelude functions null, head and tail -- polymorphic types ------------------------------------------ -- Recall recursion: fac 0 = 1 fac n | n > 0 = n * fac (n-1) -- size -- length -- sum -- reverse (inefficient) -- index (!!) -- append -- take, drop -- (!!)