5 ms·
I think your post is a bit misleading; in the OCaml example, both functions are curried. This would be a better juxtaposition (I'm mostly guessing at the syntax
by thinkpad20 13y ago
I think your post is a bit misleading; in the OCaml example, both functions are curried. This would be a better juxtaposition (I'm mostly guessing at the syntax; I'm a Haskeller).
let uncurried = fun (foo, bar, baz) -> qux
let curried = fun foo bar baz -> qux
It's a relatively small nitpick, but that's what currying means in this instance. And really, JavaScript is the same way; a function with "multiple arguments" is really just a function where the argument is a tuple. It's just that syntactically, it's cleaner in JavaScript (and many other languages) to declare and call functions with tuples.
- lrichardson 13y agoI guess I didn't mean for it to be misleading, but I wrote the example like I did on purpose to show that in OCaml, the arguments are curried by default... that there is no need to have the `fun` keyword 3 times. The misleading part was probably naming the first function "uncurried"... the point of the example was to show that they were both curried. I'll try to make this more clear in my post. Thanks.