aboutsummaryrefslogtreecommitdiff
path: root/challenge-068
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2020-07-06 12:13:51 +0100
committerGitHub <noreply@github.com>2020-07-06 12:13:51 +0100
commit203cbb1309d5a01dc5d5a86349a46679ce94f597 (patch)
treed09a5d4c7e5f86fb1daafc72ecc9300016a7f7f9 /challenge-068
parentf60e7978ffa517c705ac1815765f71dc6e78fa8a (diff)
parente4afc46c855125006a9cb7ba36a4b4157cc2bdd6 (diff)
downloadperlweeklychallenge-club-203cbb1309d5a01dc5d5a86349a46679ce94f597.tar.gz
perlweeklychallenge-club-203cbb1309d5a01dc5d5a86349a46679ce94f597.tar.bz2
perlweeklychallenge-club-203cbb1309d5a01dc5d5a86349a46679ce94f597.zip
Merge pull request #1910 from ash/ash-068
ash 068-1
Diffstat (limited to 'challenge-068')
-rw-r--r--challenge-068/ash/README2
-rw-r--r--challenge-068/ash/blog.txt1
-rw-r--r--challenge-068/ash/raku/ch-1.raku28
3 files changed, 30 insertions, 1 deletions
diff --git a/challenge-068/ash/README b/challenge-068/ash/README
index af4866aec7..c5f4656b17 100644
--- a/challenge-068/ash/README
+++ b/challenge-068/ash/README
@@ -1,3 +1,3 @@
Solution by Andrew Shitov
-Comments to the tasks 1 and 2: https://andrewshitov.com/2020/06/29/combinations-in-raku/
+Comments to the task 1: https://andrewshitov.com/2020/07/06/raku-challenge-week-68/
diff --git a/challenge-068/ash/blog.txt b/challenge-068/ash/blog.txt
new file mode 100644
index 0000000000..d2b4173d0b
--- /dev/null
+++ b/challenge-068/ash/blog.txt
@@ -0,0 +1 @@
+https://andrewshitov.com/2020/07/06/raku-challenge-week-68/
diff --git a/challenge-068/ash/raku/ch-1.raku b/challenge-068/ash/raku/ch-1.raku
new file mode 100644
index 0000000000..2da304eab0
--- /dev/null
+++ b/challenge-068/ash/raku/ch-1.raku
@@ -0,0 +1,28 @@
+#!/usr/bin/env raku
+
+# Task 1 from
+# https://perlweeklychallenge.org/blog/perl-weekly-challenge-068/
+
+# Comments: https://andrewshitov.com/2020/07/06/raku-challenge-week-68/
+
+my @input =
+ [1, 0, 1],
+ [1, 1, 1],
+ [1, 1, 1];
+
+for empty_lines(@input) X empty_lines([Z] @input) -> ($row, $col) {
+ @input[$row][$_] = 0 for ^@input[0];
+ @input[$_][$col] = 0 for ^@input;
+}
+
+say @input.join("\n");
+
+sub empty_lines(@data) {
+ grep {!all(@data[$_])}, @data.keys;
+}
+
+# Output:
+
+# 0 0 0
+# 1 0 1
+# 1 0 1