diff options
| author | chirvasitua <stuart-little@users.noreply.github.com> | 2021-03-22 08:06:12 -0400 |
|---|---|---|
| committer | chirvasitua <stuart-little@users.noreply.github.com> | 2021-03-22 19:17:58 -0400 |
| commit | 449933e76c0bfdc2842bd93493c8e91620d63da4 (patch) | |
| tree | e13ad873cd39da98473bc7370658eb2bbe05687f | |
| parent | 7c2d89ebc351875ef67e4e351cbb8d813852d8fe (diff) | |
| download | perlweeklychallenge-club-449933e76c0bfdc2842bd93493c8e91620d63da4.tar.gz perlweeklychallenge-club-449933e76c0bfdc2842bd93493c8e91620d63da4.tar.bz2 perlweeklychallenge-club-449933e76c0bfdc2842bd93493c8e91620d63da4.zip | |
1st commit on 105_raku
| -rwxr-xr-x | challenge-105/stuart-little/raku/ch-1.p6 | 11 | ||||
| -rwxr-xr-x | challenge-105/stuart-little/raku/ch-2.p6 | 20 |
2 files changed, 31 insertions, 0 deletions
diff --git a/challenge-105/stuart-little/raku/ch-1.p6 b/challenge-105/stuart-little/raku/ch-1.p6 new file mode 100755 index 0000000000..99a4786508 --- /dev/null +++ b/challenge-105/stuart-little/raku/ch-1.p6 @@ -0,0 +1,11 @@ +#!/usr/bin/env perl6 +use v6; + +# run <script> <exponent> <number> + +sub nthRoot($exp,$nr) { + my $rootFloor = (1...{($_+1) ** $exp > $nr}).[*-1]; + return ($rootFloor ** $exp == $nr) ?? ($rootFloor) !! (exp ((log $nr)/$exp)) +} + +say nthRoot(|@*ARGS[0,1]); diff --git a/challenge-105/stuart-little/raku/ch-2.p6 b/challenge-105/stuart-little/raku/ch-2.p6 new file mode 100755 index 0000000000..6d0e08d8ab --- /dev/null +++ b/challenge-105/stuart-little/raku/ch-2.p6 @@ -0,0 +1,20 @@ +#!/usr/bin/env perl6 +use v6; + +# run <script> <name> + +sub ellis($c,$name) { + qq|{$c}o-| ~ (($c eq $name.substr(0,1).lc) ?? ($name.substr(1)) !! ($c ~ $name.substr(1))); +} + +sub verse(Str $name) { + my $main = tc($name); + qq:to/END/; +$main, $main, {ellis('b',$main)} +Bonana-fanna {ellis('f',$main)} +Fee fi {ellis('m',$main)} +$main! +END +} + +say verse(@*ARGS[0]); |
