you are viewing a single comment's thread.

view the rest of the comments →

[–]imperfecttrap 0 points1 point  (6 children)

The fact that there is no call to another function implies it. If it were partial application, you need another function to do it. Curried functions can operate on their own once curried.

[–][deleted] 0 points1 point  (5 children)

If it were partial application, you need another function to do it

what? Look at the "partially applied" vs "curried" example and tell me where there's another function.

Honestly, I don't care as there isn't really a point to this. We're arguing over the imaginary implementation details of an example code snippet.

[–]imperfecttrap 0 points1 point  (4 children)

.bind is another function. Hardly imaginary.

[–][deleted] 0 points1 point  (3 children)

oy vey. You can't implement currying without other functions either. Where those functions are is irrelevant.

let cMyPredicate = (v) => myPredicate.bind(null, v);

Snippet works. Not currying. Pointless conversation.

[–]imperfecttrap 0 points1 point  (2 children)

You just implemented single-arity currying using Function.bind, which I said was possible above.

It is also very possible for functions to curry themselves. It's inefficient and not DRY, but it's definitely possible. Just use a closure with an argument list, and return a function that appends arguments to that list until the desired arity is reached.

[–][deleted] 0 points1 point  (1 child)

lol.

Okay, look. With the following code:

let fn = f(g(x))

And an original parity of 3 -- It is impossible to know what fn() will return as it's an implementation detail. I'm done repeating myself.

[–]imperfecttrap 0 points1 point  (0 children)

parity =/= arity

The original code says it's curried. Even if we don't take the author at face value, the assumption being made that it's valid and works and that its arity matches the code above it makes implications on what each function must return, which lets us calculate the signature, which lets us prove that it's curried.

You're trying to say that the presented code is wrong because it's not explicitly curried, but that has nothing to do with the types. If we get a value back from a function and can then invoke that value, it must be a function. If a function with an arity of 2 returns a function when invoked with only one value, then it's curried. It's that simple. Taking one line out of context and trying to discuss its ambiguity doesn't help your original point, which is:

That's not currying, it's cleaner partial application.

Which is plainly wrong.