diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2023-03-08 19:35:02 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-08 19:35:02 +0000 |
| commit | ef4059d9cef5bbe1cb14e4a0e2c0b6937fb7c8d0 (patch) | |
| tree | 6010cf4559c22f5614481f6faf9dd4fb917c3a16 | |
| parent | 25581bfdb9dc4955ee32b34de27fc0c2f486c9fa (diff) | |
| parent | 2c650738498ddfe07ed59d160025eeb250bc8fc2 (diff) | |
| download | perlweeklychallenge-club-ef4059d9cef5bbe1cb14e4a0e2c0b6937fb7c8d0.tar.gz perlweeklychallenge-club-ef4059d9cef5bbe1cb14e4a0e2c0b6937fb7c8d0.tar.bz2 perlweeklychallenge-club-ef4059d9cef5bbe1cb14e4a0e2c0b6937fb7c8d0.zip | |
Merge pull request #7677 from andemark/branch-for-challenge-207
Challenge 207 Solutions (Raku)
| -rw-r--r-- | challenge-207/mark-anderson/raku/ch-1.raku | 11 | ||||
| -rw-r--r-- | challenge-207/mark-anderson/raku/ch-2.raku | 17 |
2 files changed, 28 insertions, 0 deletions
diff --git a/challenge-207/mark-anderson/raku/ch-1.raku b/challenge-207/mark-anderson/raku/ch-1.raku new file mode 100644 index 0000000000..667171e7db --- /dev/null +++ b/challenge-207/mark-anderson/raku/ch-1.raku @@ -0,0 +1,11 @@ +#!/usr/bin/env raku +use Test; + +is-deeply keyboard-word(< Hello Alaska Dad Peace >), < Alaska Dad >; +is-deeply keyboard-word(< OMG Bye >), < >; +is-deeply keyboard-word(< BBC CNN OAN >), < BBC CNN >; + +sub keyboard-word(@a) +{ + @a.grep({ .lc.comb.cache (<=) any < qwertyuiop asdfghjkl zxcvbnm >>>.comb }) +} diff --git a/challenge-207/mark-anderson/raku/ch-2.raku b/challenge-207/mark-anderson/raku/ch-2.raku new file mode 100644 index 0000000000..e8e5fe332b --- /dev/null +++ b/challenge-207/mark-anderson/raku/ch-2.raku @@ -0,0 +1,17 @@ +#!/usr/bin/env raku +use Test; + +is h-index(10, 8, 5, 4, 3), 4; +is h-index(25, 8, 5, 3, 3), 3; +is h-index(25, 8, 3, 3, 3), 3; +is h-index(3), 1; +is h-index(3, 2), 2; +is h-index(0, 0, 0), 0; +is h-index(0, 0, 0, 1), 1; +is h-index(1, 1, 1, 1, 1), 1; +is h-index(9, 9, 9, 9, 9), 5; + +sub h-index(*@a) +{ + @a.sort(-*).pairs.first({ .key < .value }, :end).key.succ // 0 +} |
