PURPOSE
Demonstration of the elegance of multi subs.
multi fun fib ( Int $i where { $_ <= 1 } ) {
return $i;
}
multi fun fib ( Int $i ) {
return fib($i-1) + fib($i-2);
}
AUTHOR
Toby Inkster <tobyink@cpan.org>.
COPYRIGHT AND LICENCE
This software is copyright (c) 2013 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.