aboutsummaryrefslogtreecommitdiff
path: root/challenge-092
diff options
context:
space:
mode:
authorchirvasitua <stuart-little@users.noreply.github.com>2020-12-21 01:52:51 -0500
committerchirvasitua <stuart-little@users.noreply.github.com>2020-12-21 21:29:10 -0500
commite0601ef54d013040d2c907ea6364048fe2867823 (patch)
tree8b0a590f0ae272ec243043800d6f0fa91571cecc /challenge-092
parent122c18bebe8097db1b5059619bc61ed1ba006fc4 (diff)
downloadperlweeklychallenge-club-e0601ef54d013040d2c907ea6364048fe2867823.tar.gz
perlweeklychallenge-club-e0601ef54d013040d2c907ea6364048fe2867823.tar.bz2
perlweeklychallenge-club-e0601ef54d013040d2c907ea6364048fe2867823.zip
1st commit on 092
Diffstat (limited to 'challenge-092')
-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