This preview shows page 1. Sign up to view the full content.
Unformatted text preview: first :: [a] -> a first = error "first: can't accept empty list as input"-- first (x:xs) = x first (x:_) = x mystery :: [a] -> Int mystery (x:y:zs) = 2 mystery (x:xs) = 1 mystery _ = 0 mystery2 :: [a] -> [a] mystery2 (x:y:zs) = [y] mystery2 (x:xs) = [x] mystery2 _ = myLength :: [a] -> Int myLength = 0 myLength (x:xs) = 1 + myLength xs...
View Full Document
This note was uploaded on 02/14/2011 for the course CIS 252 taught by Professor Staff during the Spring '08 term at Syracuse.
- Spring '08