aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xchallenge-092/stuart-little/raku/ch-1.p68
-rwxr-xr-xchallenge-092/stuart-little/raku/ch-2.p610
2 files changed, 18 insertions, 0 deletions
diff --git a/challenge-092/stuart-little/raku/ch-1.p6 b/challenge-092/stuart-little/raku/ch-1.p6
new file mode 100755
index 0000000000..54db75d3cc
--- /dev/null
+++ b/challenge-092/stuart-little/raku/ch-1.p6
@@ -0,0 +1,8 @@
+#!/usr/bin/env perl6
+use v6;
+
+# run as <script> <two space-separated words>
+
+sub isop($str1,$str2) { ($str1.chars == $str2.chars) && (($str1.comb Z=> $str2.comb).unique == $str1.comb.unique == ($str2.comb Z=> $str1.comb).unique == $str2.comb.unique) }
+
+say isop(|@*ARGS).Int
diff --git a/challenge-092/stuart-little/raku/ch-2.p6 b/challenge-092/stuart-little/raku/ch-2.p6
new file mode 100755
index 0000000000..03ac94e9fe
--- /dev/null
+++ b/challenge-092/stuart-little/raku/ch-2.p6
@@ -0,0 +1,10 @@
+#!/usr/bin/env perl6
+use v6;
+
+# run as <script> <space-separated ordered interval endpoints, with the interval to be inserted coming first>
+
+sub endpts(@a) {
+ (@a (-) @a.map(*+1)).keys.sort Z (@a.map(*+1) (-) @a).keys.sort
+}
+
+say @*ARGS.map(*.Int).Hash.map({ $_.key.Int ..^ $_.value }).reduce(&infix:<(+)>).Set.keys.sort.&endpts