diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2021-06-02 03:03:56 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-02 03:03:56 +0100 |
| commit | 6b90e36a37193314719bde2e13e6a6e545bc568b (patch) | |
| tree | 0f98d230116e07e0d6db91ab528b47d9ae1e7a8d | |
| parent | e76512413feb9ebc9dd4d8edc3a90f64a8fbb250 (diff) | |
| parent | c7b70879f027e0834db8c98ca68aeea1c4b456d5 (diff) | |
| download | perlweeklychallenge-club-6b90e36a37193314719bde2e13e6a6e545bc568b.tar.gz perlweeklychallenge-club-6b90e36a37193314719bde2e13e6a6e545bc568b.tar.bz2 perlweeklychallenge-club-6b90e36a37193314719bde2e13e6a6e545bc568b.zip | |
Merge pull request #4187 from fluca1978/pwc115
Pwc115
| -rw-r--r-- | challenge-115/luca-ferrari/blog-1.txt | 1 | ||||
| -rw-r--r-- | challenge-115/luca-ferrari/blog-2.txt | 1 | ||||
| -rw-r--r-- | challenge-115/luca-ferrari/raku/ch-1.p6 | 13 | ||||
| -rw-r--r-- | challenge-115/luca-ferrari/raku/ch-2.p6 | 10 |
4 files changed, 25 insertions, 0 deletions
diff --git a/challenge-115/luca-ferrari/blog-1.txt b/challenge-115/luca-ferrari/blog-1.txt new file mode 100644 index 0000000000..661abd74c6 --- /dev/null +++ b/challenge-115/luca-ferrari/blog-1.txt @@ -0,0 +1 @@ +https://fluca1978.github.io/2021/06/01/PerlWeeklyChallenge115.html#task1 diff --git a/challenge-115/luca-ferrari/blog-2.txt b/challenge-115/luca-ferrari/blog-2.txt new file mode 100644 index 0000000000..2fd54fb047 --- /dev/null +++ b/challenge-115/luca-ferrari/blog-2.txt @@ -0,0 +1 @@ +https://fluca1978.github.io/2021/06/01/PerlWeeklyChallenge115.html#task2 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; +} |
