September 22, 1999 Perl and the Lambda Calculus Slide #35

There's a Catch

        sub my_if {
          my ($cond, $then, $else) = @_;
          if ($cond) { return $then }
          else       { return $else }
        }
        sub fact {
          my $n = shift;
          return my_if($n == 0, 1, $n*fact($n-1));
        }


Next Copyright © 1999 M-J. Dominus