diff options
| author | Mark <53903062+andemark@users.noreply.github.com> | 2023-02-13 10:34:00 +0000 |
|---|---|---|
| committer | Mark <53903062+andemark@users.noreply.github.com> | 2023-02-13 10:34:00 +0000 |
| commit | ce71c71ec00f5355aa481e5caee3f1e779b357cf (patch) | |
| tree | 5b6e2d8b90bea019353b9b36fade3d43ec0d9cb5 /challenge-204 | |
| parent | bb462577d3227fa25ed53ee261528d6543a8aad0 (diff) | |
| download | perlweeklychallenge-club-ce71c71ec00f5355aa481e5caee3f1e779b357cf.tar.gz perlweeklychallenge-club-ce71c71ec00f5355aa481e5caee3f1e779b357cf.tar.bz2 perlweeklychallenge-club-ce71c71ec00f5355aa481e5caee3f1e779b357cf.zip | |
Challenge 204 Solutions (Raku)
Diffstat (limited to 'challenge-204')
| -rw-r--r-- | challenge-204/mark-anderson/raku/ch-1.raku | 13 | ||||
| -rw-r--r-- | challenge-204/mark-anderson/raku/ch-2.raku | 13 |
2 files changed, 26 insertions, 0 deletions
diff --git a/challenge-204/mark-anderson/raku/ch-1.raku b/challenge-204/mark-anderson/raku/ch-1.raku new file mode 100644 index 0000000000..e7c4a2f3db --- /dev/null +++ b/challenge-204/mark-anderson/raku/ch-1.raku @@ -0,0 +1,13 @@ +#!/usr/bin/env raku +use Test; + +ok monotonic-array(1,2,2,3); +nok monotonic-array(1,3,2); +ok monotonic-array(6,5,5,4); + +sub monotonic-array(*@a) +{ + return 1 if [<=] @a; + return 1 if [>=] @a; + return 0 +} diff --git a/challenge-204/mark-anderson/raku/ch-2.raku b/challenge-204/mark-anderson/raku/ch-2.raku new file mode 100644 index 0000000000..da3853abe5 --- /dev/null +++ b/challenge-204/mark-anderson/raku/ch-2.raku @@ -0,0 +1,13 @@ +#!/usr/bin/env raku +use Test; + +is-deeply reshape-matrix(1, 4, [[1,2], [3,4]]), [[1,2,3,4],]; +is-deeply reshape-matrix(3, 2, [[1,2,3], [4,5,6]]), [[1,2],[3,4],[5,6]]; +nok reshape-matrix(3, 2, [[1,2]]); + +sub reshape-matrix($r, $c, @m) +{ + @m .= map(*.Slip); + return 0 if $r * $c !== @m; + @m.rotor($c).map(*.Array).Array +} |
