FP101x - week 5 Recursive Functions

factorial :: Int -> Int factorial n = product [1..n] factorial maps any integer n to the product of the integers between 1 and n ex) factorial 4 = product [1..4] = product [1,2,3,4] = 1 ...

FP101x - week 4 List Comprehensions

Set Comprehensions the comprehension notation can be used to construct new sets from old sets x <- [1..5] : generator Comprehensions can have multiple generators , separated bu commas e ...