4 ms·
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
by zmimon 18y ago
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.
- Avshalom 18y agothe duplication is to allow it to be anonymous. Your version names a function.