Haskell curries its functions. Clojure does not though it permits partial
and function macros as a comparable approach for doing the same.
I thought I recalled hearing/reading the reason behind Hickey's decision. Does someone recall what that reason was or where I could find it?
I was hoping to learn something from the rationale.
Clojure does not support automatic currying, (+3) would result in applying + to 3, resulting with number 3 instead of a function that adds 3 as in Haskell. Therefore, in Clojure we use partial that enables the equivalent behavior.
In Haskell, all functions are considered curried: That is, all functions in Haskell take just one argument. This is mostly hidden in notation, and so may not be apparent to a new Haskeller.
As functions can have multiple arities, you could have a direct function call instead of a currying function. Next, if in case you have only one arity, and you miss an argument, arity error is not detected and instead generate a currying function. A very bad and hard case to debug, especially if the function returns a function with the same asked arity, or if function is passed as an argument to another function.
So specifically creating a currying function seems legit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With