diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2025-04-21 03:35:43 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-21 03:35:43 +0100 |
| commit | beff994215df442333ef9beb7eea317463a0c79f (patch) | |
| tree | 6c49ad019a27665f681cefeaa119eb352c815c15 | |
| parent | 066c98dc3f07fca2b85aa7f4d2cc611f59c79606 (diff) | |
| parent | 82e0d8ec4d23bc151a7393cd0a8c9fd78897f875 (diff) | |
| download | perlweeklychallenge-club-beff994215df442333ef9beb7eea317463a0c79f.tar.gz perlweeklychallenge-club-beff994215df442333ef9beb7eea317463a0c79f.tar.bz2 perlweeklychallenge-club-beff994215df442333ef9beb7eea317463a0c79f.zip | |
Merge pull request #11905 from BarrOff/barroff-317
feat: add solution for challenge 317 from BarrOff
| -rw-r--r-- | challenge-317/barroff/raku/ch-1.p6 | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/challenge-317/barroff/raku/ch-1.p6 b/challenge-317/barroff/raku/ch-1.p6 new file mode 100644 index 0000000000..a2446b28c2 --- /dev/null +++ b/challenge-317/barroff/raku/ch-1.p6 @@ -0,0 +1,22 @@ +#!/usr/bin/env raku + +use v6.d; + +sub acronyms(@array, Str $word --> Bool) { + $word eq map({ ($_.comb)[0] }, @array).join; +} + +#| Run test cases +multi sub MAIN('test') { + use Test; + plan 3; + + is acronyms(["Perl", "Weekly", "Challenge"], "PWC"), True, 'works for "PWC"'; + is acronyms(["Bob", "Charlie", "Joe"], "BCJ"), True, 'works for "BCJ"'; + is acronyms(["Morning", "Good"], "MM"), False, 'works for "MM"'; +} + +#| Take user provided number like PWC Perl Weekly Challenge" +multi sub MAIN(Str $word, *@array) { + say acronyms(@array, $word); +} |
