Reference Sheet For The Exam
Reference Sheet For The Exam
This sheet will be attached to the examination paper, and lists functions and classes that
may be required in answers to the examination questions.
1
Reference: selected standard functions
Basic functions
• odd, even :: Integral a => a -> Bool
Test whether a number is odd or even
map f [x1 , x2 , . . .] = [f x1 , f x2 , . . . ]
Text processing
• words :: String -> [String]
breaks a string up into a list of words, which were delimited by white space.
Character functions
• isAlpha :: Char -> Bool
tests whether a character is alphabetic (i.e. a letter).
Input/Output
• getLine :: IO String
an action that reads a line from the console.
x /= y = not (x == y)
x == y = not (x /= y)