diff options
| -rw-r--r-- | challenge-021/simon-proctor/perl6/ch-1.p6 | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/challenge-021/simon-proctor/perl6/ch-1.p6 b/challenge-021/simon-proctor/perl6/ch-1.p6 new file mode 100644 index 0000000000..bbfac90083 --- /dev/null +++ b/challenge-021/simon-proctor/perl6/ch-1.p6 @@ -0,0 +1,17 @@ +#!/usr/bin/env perl6 + +use v6; + +multi sub MAIN( Bool :h(:$help) where so * ) { say $*USAGE; } + +#| Calulate Eulers number for up to <limit> (defaults 100) +#| also displays the system default version to compare +multi sub MAIN( + UInt $limit = 100 #= Max value of n to calcluate to +) { + my multi sub fact( 0 ) { 1 } + my multi sub fact( UInt $n ) { [*] 1..$n } + + say "Calcuated to n={$limit} {[+] (0..$limit).map({FatRat.new( 1, fact($_))})}"; + say "Constant {e}"; +} |
