import SimplePrelude hiding ((.), curry, uncurry, const) ---------------------------------------------------------------------------- -- Composition function: (.) :: (b -> c) -> (a -> b) -> (a -> c) f . g = \x -> f (g x) ex1 :: String -> Int ex1 = sum . filter (\n -> n>=65 && n<=90) . map ord curry :: ((a,b) -> c) -> a -> b -> c curry f x y = f (x,y) uncurry :: (a -> b -> c) -> (a,b) -> c uncurry f (x,y) = f x y -- Multiplies the pairwise sum of two lists: ex2 :: [Int] -> [Int] -> Int ex2 xs ys = prod (map (uncurry (+)) (zip xs ys)) where prod = foldr (*) 1 -- The always constant function const :: a -> b -> a const x _ = x