[Haskell-cafe] Partially applied functions

Casey Hawthorne caseyh at istar.ca
Sat Nov 28 13:28:04 EST 2009


Will the following do what you wish?


add :: Int -> Int -> Int
add x y = x + y

addends = [3,5,7,3,5,8]::[Int]

-- P for predicate
addPs :: (Int -> Bool) -> [Int] -> [Int -> Int]
addPs predicate addends = map add (filter predicate addends)

kP :: [Int]
kP = map (\ f -> f 10 ) (addPs (3==) addends)

--
Regards,
Casey


More information about the Haskell-Cafe mailing list