Slide 22
Slide 22 text
Function Composition with .
(.) :: (b -> c) -> (a -> b) -> a -> c
f . g = \x -> f (g x)
(reverse . sort) [2,8,7,10,1,9,5,3,4,6]
> [10,9,8,7,6,5,4,3,2,1]
reverse . sort $ [2,8,7,10,1,9,5,3,4,6]
> [10,9,8,7,6,5,4,3,2,1]
rsort :: Ord a => [a] -> [a]
rsort = reverse . sort
rsort [2,8,7,10,1,9,5,3,4,6]
> [10,9,8,7,6,5,4,3,2,1]
remove p = filter (not . p)
remove (\x -> mod x 2 == 0) [1..10]
> [1,3,5,7,9]
9 / 12