<?xml version="1.0" encoding="windows-1252"?>
<node id="541740" title="Re: recursive anonymous subroutines" created="2006-04-06 17:18:22" updated="2006-04-06 13:18:22">
<type id="11">
note</type>
<author id="961">
Anonymous Monk</author>
<data>
<field name="doctext">
Maybe you'd be interested in the &lt;a href="http://www.google.com/search?q=y+combinator+anonymous+recursion"&gt;Y combinator&lt;/a&gt;.

&lt;code&gt;
#!/usr/bin/perl -w
use strict;

print "5! = ", 
    Y(sub{ my ($proc, $n) = @_;
           ($n &lt; 2) ? 1 : $n * $proc-&gt;($proc,$n-1) }, 5), "\n";

sub Y { my ($p, $x) = @_;
        $p-&gt;($p,$x);     }

&lt;/code&gt;</field>
<field name="root_node">
541711</field>
<field name="parent_node">
541711</field>
<field name="reputation">
37</field>
</data>
</node>
