
23 May
2007
23 May
'07
12:40 p.m.
PR Stanley wrote:
What is the rationale behind currying?
Given map :: (a->b) -> [a]->[b] take :: Int -> [a] -> [a] I can write "map f . take 10" or "take 10 >>> map f". Given tmap :: (a->b, [a]) -> [b] ttake :: (Int, [a]) -> [a] I have to write "\x -> tmap(f, ttake(10, x))". It is not just syntax. Syntax messes with your mind! The former invites you to see the pipeline architecture. The latter invites you to see the execution steps. The latter risks missing the forest for the trees. The great value of the former is such that C++ STL <Functional> goes to great length to bring it back to C++.