aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-06-08 15:36:50 +0100
committerGitHub <noreply@github.com>2021-06-08 15:36:50 +0100
commit50dd542669d77b721e8ed3867ee1dd72f9067fb4 (patch)
tree7ec56ee080c2b1eac842ce776cabfd7a1756f614
parent2eaf6c909bd6146f80b08c6142f33dcf570a03da (diff)
parente1ea4c07d0bba3d8402cbe2a06527f531369a086 (diff)
downloadperlweeklychallenge-club-50dd542669d77b721e8ed3867ee1dd72f9067fb4.tar.gz
perlweeklychallenge-club-50dd542669d77b721e8ed3867ee1dd72f9067fb4.tar.bz2
perlweeklychallenge-club-50dd542669d77b721e8ed3867ee1dd72f9067fb4.zip
Merge pull request #4216 from stuart-little/stuart-little_116_raku
1st commit on 116_raku
-rwxr-xr-xchallenge-116/stuart-little/raku/ch-1.p610
-rwxr-xr-xchallenge-116/stuart-little/raku/ch-2.p68
2 files changed, 18 insertions, 0 deletions
diff --git a/challenge-116/stuart-little/raku/ch-1.p6 b/challenge-116/stuart-little/raku/ch-1.p6
new file mode 100755
index 0000000000..b86a35a058
--- /dev/null
+++ b/challenge-116/stuart-little/raku/ch-1.p6
@@ -0,0 +1,10 @@
+#!/usr/bin/env perl6
+use v6;
+
+# run <script> <number>
+
+sub consecSplit(Str $s) {
+ return (1..$s.chars).map({ $s.substr(0,$_) }).map({ (0..$s.chars).map(-> $i { $_.Int + $i }) }).map(-> @a {(0..^@a.elems).map(-> $ix {@a.[0..$ix]})}).map(-> @aa {@aa.first({ $_.join("").chars >= $s.chars })}).first({ $_.join("") eq $s })
+}
+
+consecSplit(@*ARGS[0]).say
diff --git a/challenge-116/stuart-little/raku/ch-2.p6 b/challenge-116/stuart-little/raku/ch-2.p6
new file mode 100755
index 0000000000..de605be844
--- /dev/null
+++ b/challenge-116/stuart-little/raku/ch-2.p6
@@ -0,0 +1,8 @@
+#!/usr/bin/env perl6
+use v6;
+
+# run <script> <number>
+
+my $digSqSum = @*ARGS[0].comb.map(*.Int ** 2).sum;
+($digSqSum.sqrt.Int ** 2 == $digSqSum).Int.say;
+