Theory
map captures the elementโwise transformation pattern.
Type:
Semantics
map _ [] = []
map f (x:xs) = f x : map f xsExample
squares = map (^2)
shout = map toUpperEtaโcontraction often yields pointโfree style: shout = map toUpper. Lazy and fusionโfriendly map f (map g xs) rewrites to map (f . g) xs.