Hi cafe,

Is such a thing possible,


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

-- a list of partially applied functions
adds = [add 3, add 5, add 7, add 3, add 5, add 8]

-- an example usage of the list
k = map (\ f -> f 10 ) adds

add3s = filter (?) adds -- add3s = [add 3, add 3]
addEvens = filter (?) adds --addEvens = [add 8]


I want to have functions in place of the ? signs. I guess one would need a
way of extracting the applied value from a partially applied function (or
totally, doesn't matter)

I came across such a structure while designing an algotihm and used data
structures to represent functions and solved the problem. But this doesn't
seem very *cute* to me and requires some bolier-plate (if you have a lot of
this structure everywhere) , that's why I am asking for your precious
suggestions.

Best,

-- 
Ozgur Akgun
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to