aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPolgár Márton <polgar@astron.hu>2022-10-03 00:01:09 +0200
committerPolgár Márton <polgar@astron.hu>2022-10-03 00:01:09 +0200
commit90e990aefc24dda0317b3706321210ee67e310d2 (patch)
treece2a18366213eb38cb4f2a97f39fcdc35602c4ab
parent0d281a8f25bbfd89b574252b8ed21e99ba976898 (diff)
downloadperlweeklychallenge-club-90e990aefc24dda0317b3706321210ee67e310d2.tar.gz
perlweeklychallenge-club-90e990aefc24dda0317b3706321210ee67e310d2.tar.bz2
perlweeklychallenge-club-90e990aefc24dda0317b3706321210ee67e310d2.zip
Weeklies by 2colours
-rwxr-xr-xchallenge-184/2colours/raku/ch-1.raku12
-rwxr-xr-xchallenge-184/2colours/raku/ch-2.raku19
2 files changed, 31 insertions, 0 deletions
diff --git a/challenge-184/2colours/raku/ch-1.raku b/challenge-184/2colours/raku/ch-1.raku
new file mode 100755
index 0000000000..2776ad49ed
--- /dev/null
+++ b/challenge-184/2colours/raku/ch-1.raku
@@ -0,0 +1,12 @@
+#!/usr/bin/env raku
+
+
+my @list-numbers <==
+ prompt '@list = ' andthen
+ .comb: / <[a..z]> ** 2 <[0..9]> ** 4 / andthen
+ .map: *.substr(2);
+
+('00' ... *) <<~<< @list-numbers ==>
+ map "'" ~ * ~ "'" ==>
+ join ', ' ==>
+ printf("(%s)\n"); \ No newline at end of file
diff --git a/challenge-184/2colours/raku/ch-2.raku b/challenge-184/2colours/raku/ch-2.raku
new file mode 100755
index 0000000000..e4d27a8b8b
--- /dev/null
+++ b/challenge-184/2colours/raku/ch-2.raku
@@ -0,0 +1,19 @@
+#!/usr/bin/env raku
+
+
+my @list-strings <==
+ prompt '@list = ' andthen
+ .comb: / "'" <( .*? )> "'" /;
+
+dd @list-strings;
+
+my @digits;
+my @letters;
+
+for @list-strings {
+ m/ [' '? [$<letter>=<[a..z]>|$<digit>=<[0..9]>]]* /;
+ @digits.push: $<digit>>>.Int if $<digit>;
+ @letters.push: $<letter>>>.Str if $<letter>;
+}
+
+say "@digits.raku() and @letters.raku().trans('"' => '\'')"; \ No newline at end of file