3 ms·
Technically, a section is the syntax that partially applies the operators. Currying is a different (though somewhat related) concept; yes, the standard librari
by nostrademons 17y ago
Technically, a section is the syntax that partially applies the operators. Currying is a different (though somewhat related) concept; yes, the standard libraries of both Dylan and certain Scheme implementations have gotten that wrong.
Currying is when you take a function that takes a tuple, and change it into a function that returns a function. The Haskell prelude definition has it right:
curry :: ((a, b) -> c) -> a -> b -> c
curry f x y = f (x, y)
Uncurrying is the reverse, taking a function that returns a function and making it take a tuple instead:
uncurry :: (a -> b -> c) -> ((a, b) -> c)
uncurry f p = f (fst p) (snd p)
Partial application is when you take the function that currying gave you, and apply it to only some of its initial arguments. Haskell functions are curried by default (it's pretty easy to define uncurried versions, but it's not what the syntax encourages).
</pedantic>. Yeah, I think I'm more of a language wanker (wankler?) than you are. ;-)
- jrockway 17y agoThanks for the explanation. Yeah, I think I'm more of a language wanker (wankler?) than you are. ;-) I thought about going into this much detail, but when you are engaging people that just want to insult, it is probably not worth the time. Better to use the time to use these clearly-useless features to write clearly-useful programs instead :)