diff options
| author | Luca Ferrari <fluca1978@gmail.com> | 2021-06-01 12:17:51 +0200 |
|---|---|---|
| committer | Luca Ferrari <fluca1978@gmail.com> | 2021-06-01 12:17:51 +0200 |
| commit | c89d79cca37ff8afc48102a495d427b3fc86caee (patch) | |
| tree | b001e1195b31c9c72c86e89dc1f97c4b9885aa6b | |
| parent | 29c0d0431b10dc1fec1038a165a02916a1053c89 (diff) | |
| download | perlweeklychallenge-club-c89d79cca37ff8afc48102a495d427b3fc86caee.tar.gz perlweeklychallenge-club-c89d79cca37ff8afc48102a495d427b3fc86caee.tar.bz2 perlweeklychallenge-club-c89d79cca37ff8afc48102a495d427b3fc86caee.zip | |
Task 1 and 2 done
| -rw-r--r-- | challenge-115/luca-ferrari/raku/ch-1.p6 | 13 | ||||
| -rw-r--r-- | challenge-115/luca-ferrari/raku/ch-2.p6 | 10 |
2 files changed, 23 insertions, 0 deletions
diff --git a/challenge-115/luca-ferrari/raku/ch-1.p6 b/challenge-115/luca-ferrari/raku/ch-1.p6 new file mode 100644 index 0000000000..078dc2e32d --- /dev/null +++ b/challenge-115/luca-ferrari/raku/ch-1.p6 @@ -0,0 +1,13 @@ +#!raku + +sub MAIN( *@words where { @words.elems > 0 } ) { + + # get a list of all initiali letters + # and one of all tailing ones + my @headings = @words.map: *.substr( 0, 1 ); + my @tailings = @words.map: *.substr( * - 1 ); + + # if the sorted list are the same, there is a match! + say @headings.sort ~~ @tailings.sort ?? 1 !! 0; + +} diff --git a/challenge-115/luca-ferrari/raku/ch-2.p6 b/challenge-115/luca-ferrari/raku/ch-2.p6 new file mode 100644 index 0000000000..18809e844f --- /dev/null +++ b/challenge-115/luca-ferrari/raku/ch-2.p6 @@ -0,0 +1,10 @@ +#!raku + +sub MAIN( *@N where { @N.elems > 0 && @N.grep( * ~~ Int ).elems == @N.elems } ) { + # create a list of integers + # with only those that are divisible by 2 + my Int @numbers.push: .join.Int if .join.Int %% 2 for @N.permutations; + + # now ask for the max + say @numbers.max; +} |
