Hacker News new | ask | show | jobs
by nothrabannosir 3575 days ago
Very cool!

I'm surprised by this one:

https://bloomberg.github.io/bucklescript/js-demo/#Curry_Opti...

Why doesn't it actually curry? Impressive output, don't get me wrong. But given how native and idiomatic currying is in Javascript, and how much trouble I'd expect this to have taken to implement... is there a specific reason for this? Just curious.

Anyway, again: very impressive. Thanks.

EDIT clarification: I expected:

    function f(param) {
        return curry(32, param);
    }
(or is this to highlight the difference between currying and partial function application?)
2 comments

Looks like it's just an optimization. If you change to

  let test_curry x  y =  x + y + x
You get the expected output

  function f(param) {
    return test_curry(32, param);
  }
btw, we also have native uncurried calling convention support to make callback even more efficient