News for hackers. Stuff that matters.
Re:The Y Combinator in Arc and Java by caustic on Monday March 02, 2009 @02:40PM (#500515)
Re:The Y Combinator in Arc and Java by zmimon on Monday March 02, 2009 @06:36PM (#500793)
I'm not very literate in functional programming ... so excuse such a dumb question. But I'm curious why you write the recursing function duplicated? eg. isn't this version of your code equivalent?

    function Y(X) {
      var fn = function(procedure) {
        return X(function(arg) {
          return procedure(procedure)(arg);
        });
      };
      return fn(fn);
    }
Or am I missing something vital here about how it is all working? The shorter version seems clearer to me (not that any of this is clear to me), and functionally equivalent.
Re:The Y Combinator in Arc and Java by Avshalom on Monday March 02, 2009 @07:16PM (#500837)
the duplication is to allow it to be anonymous. Your version names a function.