aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchirvasitua <stuart-little@users.noreply.github.com>2021-03-22 08:06:12 -0400
committerchirvasitua <stuart-little@users.noreply.github.com>2021-03-22 19:17:58 -0400
commit449933e76c0bfdc2842bd93493c8e91620d63da4 (patch)
treee13ad873cd39da98473bc7370658eb2bbe05687f
parent7c2d89ebc351875ef67e4e351cbb8d813852d8fe (diff)
downloadperlweeklychallenge-club-449933e76c0bfdc2842bd93493c8e91620d63da4.tar.gz
perlweeklychallenge-club-449933e76c0bfdc2842bd93493c8e91620d63da4.tar.bz2
perlweeklychallenge-club-449933e76c0bfdc2842bd93493c8e91620d63da4.zip
1st commit on 105_raku
-rwxr-xr-xchallenge-105/stuart-little/raku/ch-1.p611
-rwxr-xr-xchallenge-105/stuart-little/raku/ch-2.p620
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]);