diff options
| author | Andrew Shitov <andy@shitov.ru> | 2020-07-06 12:03:23 +0200 |
|---|---|---|
| committer | Andrew Shitov <andy@shitov.ru> | 2020-07-06 12:03:23 +0200 |
| commit | e4afc46c855125006a9cb7ba36a4b4157cc2bdd6 (patch) | |
| tree | c377d34146227e810315eaa4dde649a479687d98 /challenge-068 | |
| parent | 5293ff2999ca96715e38bff3a90c0710e0ff66e3 (diff) | |
| download | perlweeklychallenge-club-e4afc46c855125006a9cb7ba36a4b4157cc2bdd6.tar.gz perlweeklychallenge-club-e4afc46c855125006a9cb7ba36a4b4157cc2bdd6.tar.bz2 perlweeklychallenge-club-e4afc46c855125006a9cb7ba36a4b4157cc2bdd6.zip | |
ash 068-1
Diffstat (limited to 'challenge-068')
| -rw-r--r-- | challenge-068/ash/README | 2 | ||||
| -rw-r--r-- | challenge-068/ash/blog.txt | 1 | ||||
| -rw-r--r-- | challenge-068/ash/raku/ch-1.raku | 28 |
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 |
