26
votes

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.

1
I assume at least part of the reason is Clojure is not 100% lazy and application cannot be deferred - guilespi
Your first sentence is not accurate. Haskell curries all functions, no matter how many arguments are supplied. In truth, all Haskell functions take one input and return one output. wiki.haskell.org/Currying wiki.haskell.org/Composing_functions_with_multiple_values . In Haskell the uncurry function doesn't actually uncurry; instead, it takes the first two functions in the chain and composes them into one function which takes a pair as its single input. - itsbruce
paying homage to Haskell Curry. - rem
I'm pretty sure this is because java functions can be polyvariadic (having variable argument numbers), so clojure should follow suit. - AJF
In short, fixed-parameter functions are well-suited to auto-currying while multi-arity functions are not. Thus, when you develop an api, if you want auto-currying, avoid the latter and prefer the former. - Mario

1 Answers

28
votes

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.