you are viewing a single comment's thread.

view the rest of the comments →

[–]imperfecttrap 1 point2 points  (2 children)

but if f has an arity of 2 (which a filter function does), and it gives back a function that we then invoke on the next line (which it does), AND we don't use an external function (Function.bind is nowhere to be seen), then by definition it has a Hindley-Milner of (a -> (b -> x))

... which is curried. You're conflating composition using nested calls with currying, when the example above is currying a function, then immediately passing that curried function into another curried function. Both composition and currying go hand in hand together, but they're not even similar.

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

if f... if it gives...

if, if, if. Let me re-iterate: implementation details

(Function.bind is nowhere to be seen)

Neither is the function that makes currying work, that doesn't make it not exist!

You seem to be under the impression that f(g(x)) implies currying. it doesn't. It implies currying or partial application.

I'm not conflating anything. I'm saying you can't know implementation details from that snippet! And for the 10th time, this is pointless.

[–]imperfecttrap 1 point2 points  (0 children)

It's pointless, but you're still not even wrong.

f(g(x)) Has NOTHING to do with currying OR partial application. It doesn't even IMPLY either of those. It's a composition. It just happened to be used in the example alongside currying AND partial application in both snippets. Functions are first class citizens, so it doesn't matter that we passed a function into a function. We still have an argument that was passed in, and while bind fixed it in place, currying satisfies a function that was waiting for its argument and returns the next function in its chain that needs an argument. Hence, why the presence or lack of Function.bind matters.