Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
TODO list is empty! :(
  • Loading branch information
Filip Sergot committed Apr 22, 2012
1 parent 677edbd commit a668858
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
3 changes: 0 additions & 3 deletions best-of-rosettacode/TODO
@@ -1,3 +0,0 @@
http://rosettacode.org/wiki/24_game#Perl_6 - a little grammar, casting (?), eval, prompt, roll
http://rosettacode.org/wiki/Ackermann_function#Perl_6 - easy example of multi, ?? !!

34 changes: 34 additions & 0 deletions best-of-rosettacode/ackermann-function.pl
@@ -0,0 +1,34 @@
=begin pod
=head1 Ackermann function
The Ackermann function is a classic recursive example in computer science.
=head1 More
L<http://rosettacode.org/wiki/Ackermann_function#Perl_6>
=head1 What's interesting here?
=item ternary chaining
=item recursive funtion
=end pod
sub A(Int $m, Int $n) {
$m == 0 ?? $n + 1 !!
$n == 0 ?? A($m - 1, 1 ) !!
A($m - 1, A($m, $n - 1));
}
A(1, 2).say;
=begin pod
=head1 Features used
=item C<ternary operator> - L<http://perlcabal.org/syn/S03.html#Conditional_operator_precedence>
=item C<multi subs> - L<http://perlcabal.org/syn/S12.html#Multisubs_and_Multimethods>
=end pod

0 comments on commit a668858

Please sign in to comment.