NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
not in HOP (Score:1)
An interesting twist on eval, Function() creates a function reference out of an array of strings.
And this JS 1.5 syntax, which gives an anonymous closure a temporary name so it can refer to itself.
Despite appearances, there is no fact(). That was just a name for use during the definition of f.
I have tried to do this in Perl and failed. Someone told me one could do it with a Y combinator.
Reply to This
Re:not in HOP (Score:2)
But that doesn't work, because sub is defined outside the scope of $f. So you've got to do this:
That works!
(GC note: now $f and that sub constitute a circular data structure, so you need to do $f='whatever'; (or just undef($f)) to break the circularity.)
Re:not in HOP (Score:1)
And with arguments.callee (Score:2)