Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
2 changed files
with
34 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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, ?? !! | ||
|
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |