diff options
| author | Scimon <simon.proctor@gmail.com> | 2023-06-05 11:12:04 +0100 |
|---|---|---|
| committer | Scimon <simon.proctor@gmail.com> | 2023-06-05 11:12:04 +0100 |
| commit | 1e3daa9a29a5e6d39b95e526a360ca89c344aa56 (patch) | |
| tree | 84617b994337386e54a27abc3551b3b0769922d4 | |
| parent | 401be1861472af6d62bbdeb0fe65f6ced1ca8f31 (diff) | |
| download | perlweeklychallenge-club-1e3daa9a29a5e6d39b95e526a360ca89c344aa56.tar.gz perlweeklychallenge-club-1e3daa9a29a5e6d39b95e526a360ca89c344aa56.tar.bz2 perlweeklychallenge-club-1e3daa9a29a5e6d39b95e526a360ca89c344aa56.zip | |
Part 1 (Yup. I'm back)
| -rw-r--r-- | challenge-220/simon-proctor/raku/ch-1.raku | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/challenge-220/simon-proctor/raku/ch-1.raku b/challenge-220/simon-proctor/raku/ch-1.raku new file mode 100644 index 0000000000..c6043d4548 --- /dev/null +++ b/challenge-220/simon-proctor/raku/ch-1.raku @@ -0,0 +1,16 @@ +#!/usr/bin/env raku + +#| Given a list of words return a list of letters that appear in all of them +multi sub MAIN( *@words ) { + found-letters(@words).join(' ').say; +} + +multi sub MAIN('TEST') { + use Test; + is found-letters( 'Perl', 'Rust', 'Raku' ), ('r'); + is found-letters( 'love', 'live', 'leave' ), ('e','l','v'); +} + +sub found-letters ( *@words ) { + ( [∩] @words.map( *.fc.comb ) ).keys.sort; +} |
