aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2022-09-05 15:15:34 +0100
committerGitHub <noreply@github.com>2022-09-05 15:15:34 +0100
commit65a406c3c49dd48e01a50ecef440e8400f543f98 (patch)
tree7ab8c329149a573670fb2ce24552c3f9fba5400a
parentf806a45cf38019c818f519237e42ee62fa9d4837 (diff)
parent963fa84611ed60f110952df1213c60a19dfe1510 (diff)
downloadperlweeklychallenge-club-65a406c3c49dd48e01a50ecef440e8400f543f98.tar.gz
perlweeklychallenge-club-65a406c3c49dd48e01a50ecef440e8400f543f98.tar.bz2
perlweeklychallenge-club-65a406c3c49dd48e01a50ecef440e8400f543f98.zip
Merge pull request #6700 from andemark/branch-for-challenge-181
Challenge 181 Solutions (Raku)
-rw-r--r--challenge-181/mark-anderson/raku/ch-1.raku8
-rw-r--r--challenge-181/mark-anderson/raku/ch-2.raku8
-rw-r--r--challenge-181/mark-anderson/raku/paragraph.txt5
-rw-r--r--challenge-181/mark-anderson/raku/temps.txt10
4 files changed, 31 insertions, 0 deletions
diff --git a/challenge-181/mark-anderson/raku/ch-1.raku b/challenge-181/mark-anderson/raku/ch-1.raku
new file mode 100644
index 0000000000..00d463e75b
--- /dev/null
+++ b/challenge-181/mark-anderson/raku/ch-1.raku
@@ -0,0 +1,8 @@
+#!/usr/bin/env raku
+use Text::Wrap;
+
+say wrap-text('paragraph.txt'.IO.slurp
+ .trans(/\n/ => ' ')
+ .split('.')
+ .map({ .words.sort(*.lc) })
+ .join('. '), :width(60));
diff --git a/challenge-181/mark-anderson/raku/ch-2.raku b/challenge-181/mark-anderson/raku/ch-2.raku
new file mode 100644
index 0000000000..2171e768a3
--- /dev/null
+++ b/challenge-181/mark-anderson/raku/ch-2.raku
@@ -0,0 +1,8 @@
+#!/usr/bin/env raku
+
+say 'temps.txt'.IO.lines
+ .sort
+ .rotor(2 => -1)
+ .grep({ .[0].match(/\d+$/) < .[1].match(/\d+$/) })
+ .map( { .[1].match(/<[\d-]>+/) })
+ .join("\n");
diff --git a/challenge-181/mark-anderson/raku/paragraph.txt b/challenge-181/mark-anderson/raku/paragraph.txt
new file mode 100644
index 0000000000..af2d76e73b
--- /dev/null
+++ b/challenge-181/mark-anderson/raku/paragraph.txt
@@ -0,0 +1,5 @@
+All he could think about was how it would all end. There was
+still a bit of uncertainty in the equation, but the basics
+were there for anyone to see. No matter how much he tried to
+see the positive, it wasn't anywhere to be seen. The end was
+coming and it wasn't going to be pretty.
diff --git a/challenge-181/mark-anderson/raku/temps.txt b/challenge-181/mark-anderson/raku/temps.txt
new file mode 100644
index 0000000000..7b251c9aec
--- /dev/null
+++ b/challenge-181/mark-anderson/raku/temps.txt
@@ -0,0 +1,10 @@
+2022-08-01, 20
+2022-08-09, 10
+2022-08-03, 19
+2022-08-06, 24
+2022-08-05, 22
+2022-08-10, 28
+2022-08-07, 20
+2022-08-04, 18
+2022-08-08, 21
+2022-08-02, 25