diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2021-02-10 00:07:36 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-10 00:07:36 +0000 |
| commit | d2fa87e9987ab2d9b6d8021fc3fbfae06d2d95da (patch) | |
| tree | ae916b6349962b86748bbbfd01a0adea6d94d0c7 /challenge-099 | |
| parent | f35d8fe325837329e58dc602f123b07f53f8d204 (diff) | |
| parent | d54a1c6e895251e2b45370dd448802c40288f453 (diff) | |
| download | perlweeklychallenge-club-d2fa87e9987ab2d9b6d8021fc3fbfae06d2d95da.tar.gz perlweeklychallenge-club-d2fa87e9987ab2d9b6d8021fc3fbfae06d2d95da.tar.bz2 perlweeklychallenge-club-d2fa87e9987ab2d9b6d8021fc3fbfae06d2d95da.zip | |
Merge pull request #3491 from andemark/branch-for-challenge-099
Challenge 99 Solutions (Raku)
Diffstat (limited to 'challenge-099')
| -rw-r--r-- | challenge-099/mark-anderson/raku/ch-1.raku | 13 | ||||
| -rw-r--r-- | challenge-099/mark-anderson/raku/ch-2.raku | 11 |
2 files changed, 24 insertions, 0 deletions
diff --git a/challenge-099/mark-anderson/raku/ch-1.raku b/challenge-099/mark-anderson/raku/ch-1.raku new file mode 100644 index 0000000000..84ea24421b --- /dev/null +++ b/challenge-099/mark-anderson/raku/ch-1.raku @@ -0,0 +1,13 @@ +#!/usr/bin/env raku +use Test; +plan 4; + +is pattern-match("abcde", "a*e"), 1; +is pattern-match("abcde", "a*d"), 0; +is pattern-match("abcde", "?b*d"), 0; +is pattern-match("abcde", "a*c?e"), 1; + +sub pattern-match($S, $P) +{ + ($S ~~ / ^ <{ $P.trans: <? *> => <. .*> }> $ /).Bool.UInt; +} diff --git a/challenge-099/mark-anderson/raku/ch-2.raku b/challenge-099/mark-anderson/raku/ch-2.raku new file mode 100644 index 0000000000..88bf596ded --- /dev/null +++ b/challenge-099/mark-anderson/raku/ch-2.raku @@ -0,0 +1,11 @@ +#!/usr/bin/env raku +use Test; +plan 2; + +is unique-subsequences("littleit", "lit"), 5; +is unique-subsequences("london", "lon"), 3; + +sub unique-subsequences($S, $T) +{ + +($S ~~ m:ex/ <{ $T.comb.join(" .* ") }> /); +} |
