aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPolgár Márton <polgar@astron.hu>2022-07-17 10:53:28 +0200
committerPolgár Márton <polgar@astron.hu>2022-07-17 10:53:28 +0200
commitf838f3d0c6cebe7495c6ce81d371b0208adbcf40 (patch)
tree5184fd9484ce2a215d9eb9ece95bf6c8a11850ce
parent753d19e9546dfd295e36874df9fb823c0e87a45c (diff)
downloadperlweeklychallenge-club-f838f3d0c6cebe7495c6ce81d371b0208adbcf40.tar.gz
perlweeklychallenge-club-f838f3d0c6cebe7495c6ce81d371b0208adbcf40.tar.bz2
perlweeklychallenge-club-f838f3d0c6cebe7495c6ce81d371b0208adbcf40.zip
Week 173 solutions by 2colours
-rwxr-xr-xchallenge-173/2colours/raku/ch-1.raku11
-rwxr-xr-xchallenge-173/2colours/raku/ch-2.raku7
2 files changed, 18 insertions, 0 deletions
diff --git a/challenge-173/2colours/raku/ch-1.raku b/challenge-173/2colours/raku/ch-1.raku
new file mode 100755
index 0000000000..a7e8f92a7b
--- /dev/null
+++ b/challenge-173/2colours/raku/ch-1.raku
@@ -0,0 +1,11 @@
+#!/usr/bin/env raku
+
+
+subset Digit of Int where *.chars == 1;
+
+sub infix:<nN>(Digit() $a, Digit() $b) is assoc<chain> {
+ abs($a - $b) == 1
+}
+
+my $n = prompt 'Input: ';
+say [nN] $n.comb;
diff --git a/challenge-173/2colours/raku/ch-2.raku b/challenge-173/2colours/raku/ch-2.raku
new file mode 100755
index 0000000000..93488ab87c
--- /dev/null
+++ b/challenge-173/2colours/raku/ch-2.raku
@@ -0,0 +1,7 @@
+#!/usr/bin/env raku
+
+
+(2,), { my $new = 1 + [*] .[]; (|$_, $new) } ... { $_ == 10 } andthen
+ .tail
+ .join: "\n" andthen
+ .say;