diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2024-01-29 02:21:09 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-29 02:21:09 +0000 |
| commit | 4653b34e6fa516cecb0d52bdfd7cf8ded571d0e6 (patch) | |
| tree | aded9a5abcdcab48b5634077c9b3111b69d503c2 | |
| parent | 9d7fbcb5c20d3f10f243cc05fef3e036962b6948 (diff) | |
| parent | 554b4f8f85993eb1f6bff346f45d4add7817b3f5 (diff) | |
| download | perlweeklychallenge-club-4653b34e6fa516cecb0d52bdfd7cf8ded571d0e6.tar.gz perlweeklychallenge-club-4653b34e6fa516cecb0d52bdfd7cf8ded571d0e6.tar.bz2 perlweeklychallenge-club-4653b34e6fa516cecb0d52bdfd7cf8ded571d0e6.zip | |
Merge pull request #9479 from Util/c253
Add TWC 253 solutions by Bruce Gray (in Raku only).
| -rw-r--r-- | challenge-253/bruce-gray/raku/ch-1.raku | 11 | ||||
| -rw-r--r-- | challenge-253/bruce-gray/raku/ch-2.raku | 28 |
2 files changed, 39 insertions, 0 deletions
diff --git a/challenge-253/bruce-gray/raku/ch-1.raku b/challenge-253/bruce-gray/raku/ch-1.raku new file mode 100644 index 0000000000..0fafe80d5d --- /dev/null +++ b/challenge-253/bruce-gray/raku/ch-1.raku @@ -0,0 +1,11 @@ +sub task1 { @^words».split($^seperator, :skip-empty).flat } + + +my @tests = + ( '.' , <one.two.three four.five six> , <one two three four five six> ), + ( '$' , <$perl$$ $$raku$> , <perl raku> ), +; +use Test; plan +@tests; +for @tests -> ( $in_sep, @in_strings, @expected ) { + is-deeply task1( $in_sep, @in_strings ), @expected; +} diff --git a/challenge-253/bruce-gray/raku/ch-2.raku b/challenge-253/bruce-gray/raku/ch-2.raku new file mode 100644 index 0000000000..5fd155003c --- /dev/null +++ b/challenge-253/bruce-gray/raku/ch-2.raku @@ -0,0 +1,28 @@ +sub task2 { @^matrix.sort: :k, { +.grep(1) } } + + +my @tests = + ( + ( + (1, 1, 0, 0, 0), + (1, 1, 1, 1, 0), + (1, 0, 0, 0, 0), + (1, 1, 0, 0, 0), + (1, 1, 1, 1, 1), + ), + (2, 0, 3, 1, 4), + ), + ( + ( + (1, 0, 0, 0), + (1, 1, 1, 1), + (1, 0, 0, 0), + (1, 0, 0, 0), + ), + (0, 2, 3, 1), + ), +; +use Test; plan +@tests; +for @tests -> ( @matrix, @expected ) { + is-deeply task2( @matrix ), @expected; +} |
