Stories
Slash Boxes
Comments
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

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • That doesn’t actually work because $fact doesn’t exist at the time you call it.

    So you simply use the Y combinator [perl.org]. :-)

    • I had thought of that when I was writing this, but I confess that I never really understood why people were so hot and bothered about the Y combinator. There's a point when complexity overrides functionality. That being said, it may simply be a case of my being dense, but an awful lot of smart people seem to struggle with this :)

      • Complexity of what? The Y combinator is easy to use: you return the recursive closure from another closure; the first argument of the outer closure can be used in the inner closure to return. That’s it.

        The difficulty is in deriving the exact form of the combinator (which, of course, is a bit of brain-melt, which is why it’s become a sort of sport), not in using it.