Edit this page Backlinks This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ===== Higher order functions and functional closures ===== Using: **higher-order functions**, **infix/prefix** notation, **anonymous functions (lambdas)** and **functional closures** to write better code: <code haskell> import Data.Char -- map examples addOne :: [Integer] -> [Integer] addOne = map (+1) remHead = map tail toString = map (:[]) fold op acc [] = acc fold op acc (x:xs) = x `op` (fold op acc xs) sum = foldr (+) 0 -- operatia de adunare, prefixata, este (+) makeLower = foldr ((:).toLower) [] reverse :: [a] -> [a] reverse = foldl (\acc x -> x:acc) [] </code>