Open eprochasson opened 8 years ago
I thought OCaml used currying, and while you may see multiple parameters, it's actually handled one parameter at a time?
I don't know how the implementation is actually done (I doubt it curries everything every time), and although you might be right, function can still be declared and take multiple parameters. You can easily try it for yourself. The fact that under the hood it uses single argument function or not does not have much influence on the way you declare and use functions.
I'm not sure I follow what you say when you write
A function always has exactly one parameter, and returns one result.
. Functions can have multiple arguments:min takes 2 arguments of type
'a
and returns one value of type'a
. They can then be partially applied:returns a new function that takes one argument and return one value (the smallest one between the argument and 2), that one can use like:
More directly