Hacker News new | past | comments | ask | show | jobs | submit login

So who creates the λ functional JavaScript library?



I'll start:

    function λ(code) {
      return eval(
    	"function () {"+
    	"   var $=arguments;" +
    	"   return " + code + ";"
    	"}"
      );
    }

    var sum = map([1,2,3,4], λ("$[0] + $[1]"));
    

I'm not really serious, but I'd like eval-less version of this, very, very much.

    function(x,y) { return x*y; }
is so verbose.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: