Skip to content

Comment on Programming languages to watch: LiveScript, Julia, Elixirparent

Comments

You get a function that can take N arguments and return a value, or 1 to N-1 arguments and return a function representing a partial application, which itself exhibits the same behavior:

   add3 = (a, b, c) --> a + b + c

   x = add3 1
   y = x 1
   z = y 1 # z = 3
If you look at the compiled code, it is actually an abstraction over a partial application, but at that point is that not just an implementation detail?

I agree it is not really important.

The main difference between the two I see is that partial application basically binds a certain argument to a fixed value, while currying only changes the way the function is called (thus allowing for easier partial application). It is easier to see on a function with more than two arguments. Imagine f:(A×B×C)->D. Currying it will yield f':A->(B->(C->D)), so you would call it as f'(1)(2)(3). On the other hand, partially applying on first argument it would yield f'':(B×C)->D.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.