aboutsummaryrefslogtreecommitdiff
path: root/challenge-116
diff options
context:
space:
mode:
authorchirvasitua <stuart-little@users.noreply.github.com>2021-06-07 07:58:30 -0400
committerchirvasitua <stuart-little@users.noreply.github.com>2021-06-07 07:58:30 -0400
commite1ea4c07d0bba3d8402cbe2a06527f531369a086 (patch)
treec3bdf529cd806476767521dba111305e70c04e55 /challenge-116
parent4830b1d50fd610eb2424fe284cb48a2795e0478c (diff)
downloadperlweeklychallenge-club-e1ea4c07d0bba3d8402cbe2a06527f531369a086.tar.gz
perlweeklychallenge-club-e1ea4c07d0bba3d8402cbe2a06527f531369a086.tar.bz2
perlweeklychallenge-club-e1ea4c07d0bba3d8402cbe2a06527f531369a086.zip
1st commit on 116_raku
Diffstat (limited to 'challenge-116')
-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;
+