i trying basic lambda calculus in javascript , using node repl. define identity , mockinbird combinator , run mockingbird combinator identity combinator input.
i = f => f m = f => f(f) m(i)
the mockinbird combinator identity combinator input yields identity combinator. last line gives following output.
[function]
but more useful, in case, if outputted following.
[function: i]
this way can see function being printed. have seen done in youtube video: https://www.youtube.com/watch?v=3vq382qg-y4
does have idea how achieve this?
newer versions of node.js (at least v6+, maybe earlier). if don't want upgrade, define inspect method, node.js use when inspecting:
function.prototype.inspect = function () { return "[function: " + this.name + "]"; }
Comments
Post a Comment