Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rich Hickey's reason for not auto-currying Clojure functions?

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.

like image 732
Mario Avatar asked Jul 12 '15 23:07

Mario


People also ask

Does Clojure have currying?

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.

Are all functions in Haskell curried?

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.


1 Answers

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.

like image 71
Ivan Pierre Avatar answered Oct 15 '22 03:10

Ivan Pierre