diff options
| author | Mohammad Sajid Anwar <mohammad.anwar@yahoo.com> | 2025-07-23 22:29:32 +0100 |
|---|---|---|
| committer | Mohammad Sajid Anwar <mohammad.anwar@yahoo.com> | 2025-07-23 22:29:32 +0100 |
| commit | 1133deffe417e44310790a0d58a11fe9312e2e5a (patch) | |
| tree | 0415502b369c3febda5e23b678f012659cbfd0be | |
| parent | 341ef64e3d8a51b177f3e6f5a86b7d95d47c81c5 (diff) | |
| download | perlweeklychallenge-club-1133deffe417e44310790a0d58a11fe9312e2e5a.tar.gz perlweeklychallenge-club-1133deffe417e44310790a0d58a11fe9312e2e5a.tar.bz2 perlweeklychallenge-club-1133deffe417e44310790a0d58a11fe9312e2e5a.zip | |
- Added solutions by Arne Sommer.
- Added solutions by Yitzchak Scott-Thoennes.
29 files changed, 198 insertions, 44 deletions
diff --git a/challenge-331/arne-sommer/blog.txt b/challenge-331/arne-sommer/blog.txt new file mode 100644 index 0000000000..c4a6aca374 --- /dev/null +++ b/challenge-331/arne-sommer/blog.txt @@ -0,0 +1 @@ +https://raku-musings.com/last-buddy.html diff --git a/challenge-331/arne-sommer/raku/buddy-strings b/challenge-331/arne-sommer/raku/buddy-strings new file mode 100644 index 0000000000..de7a7672c2 --- /dev/null +++ b/challenge-331/arne-sommer/raku/buddy-strings @@ -0,0 +1,31 @@ +#! /usr/bin/env raku + +unit sub MAIN ($source where $source.chars > 0, + $destination where $destination.chars > 0, + :v(:$verbose)); + +if $destination.chars != $source.chars +{ + say ": Different string lengths; { $source.chars } vs { $destination.chars }" + if $verbose; + say False; +} +else +{ + my @pairs = $source.comb Z $destination.comb; + say ": Pairs: { @pairs.raku }" if $verbose; + + my @changes = @pairs.grep({ $_[0] ne $_[1] }); + say ": Pairs with changes: { @changes.raku }" if $verbose; + + if @changes.elems == 2 + { + say @changes[0][0] eq @changes[1][1] && + @changes[1][1] eq @changes[0][0]; + } + else + { + say ": Not two pairs of letters that differ, got { @changes.elems}" if $verbose; + say False; + } +} diff --git a/challenge-331/arne-sommer/raku/buddy-strings-ok b/challenge-331/arne-sommer/raku/buddy-strings-ok new file mode 100644 index 0000000000..ae91b7cf5a --- /dev/null +++ b/challenge-331/arne-sommer/raku/buddy-strings-ok @@ -0,0 +1,36 @@ +#! /usr/bin/env raku + +unit sub MAIN ($source where $source.chars > 0, + $destination where $destination.chars > 0, + :v(:$verbose)); + +if $destination.chars != $source.chars +{ + say ": Different string lengths; { $source.chars } vs { $destination.chars }" + if $verbose; + say False; +} +else +{ + my @pairs = $source.comb Z $destination.comb; + say ": Pairs: { @pairs.raku }" if $verbose; + + my @changes = @pairs.grep({ $_[0] ne $_[1] }); + say ": Pairs with changes: { @changes.raku }" if $verbose; + + if @changes.elems == 2 + { + say @changes[0][0] eq @changes[1][1] && + @changes[1][1] eq @changes[0][0]; + } + elsif @changes.elems == 0 && $source.comb.repeated.elems + { + say ": Identical strings, but we can swap duplicates" if $verbose; + say True; + } + else + { + say ": Not two pairs of letters that differ, got { @changes.elems}" if $verbose; + say False; + } +} diff --git a/challenge-331/arne-sommer/raku/ch-1.raku b/challenge-331/arne-sommer/raku/ch-1.raku new file mode 100644 index 0000000000..72da332298 --- /dev/null +++ b/challenge-331/arne-sommer/raku/ch-1.raku @@ -0,0 +1,8 @@ +#! /usr/bin/env raku + +unit sub MAIN ($str where $str.chars > 0, + :v(:$verbose)); + +say ": Last word: '{ $str.words.tail }'" if $verbose; + +say $str.words.tail.chars; diff --git a/challenge-331/arne-sommer/raku/ch-2.raku b/challenge-331/arne-sommer/raku/ch-2.raku new file mode 100644 index 0000000000..ae91b7cf5a --- /dev/null +++ b/challenge-331/arne-sommer/raku/ch-2.raku @@ -0,0 +1,36 @@ +#! /usr/bin/env raku + +unit sub MAIN ($source where $source.chars > 0, + $destination where $destination.chars > 0, + :v(:$verbose)); + +if $destination.chars != $source.chars +{ + say ": Different string lengths; { $source.chars } vs { $destination.chars }" + if $verbose; + say False; +} +else +{ + my @pairs = $source.comb Z $destination.comb; + say ": Pairs: { @pairs.raku }" if $verbose; + + my @changes = @pairs.grep({ $_[0] ne $_[1] }); + say ": Pairs with changes: { @changes.raku }" if $verbose; + + if @changes.elems == 2 + { + say @changes[0][0] eq @changes[1][1] && + @changes[1][1] eq @changes[0][0]; + } + elsif @changes.elems == 0 && $source.comb.repeated.elems + { + say ": Identical strings, but we can swap duplicates" if $verbose; + say True; + } + else + { + say ": Not two pairs of letters that differ, got { @changes.elems}" if $verbose; + say False; + } +} diff --git a/challenge-331/arne-sommer/raku/last-word b/challenge-331/arne-sommer/raku/last-word new file mode 100644 index 0000000000..72da332298 --- /dev/null +++ b/challenge-331/arne-sommer/raku/last-word @@ -0,0 +1,8 @@ +#! /usr/bin/env raku + +unit sub MAIN ($str where $str.chars > 0, + :v(:$verbose)); + +say ": Last word: '{ $str.words.tail }'" if $verbose; + +say $str.words.tail.chars; diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 60e5109a7a..45c36db081 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -37,6 +37,20 @@ { "data" : [ [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Arne Sommer", + "name" : "Arne Sommer" + }, + { + "data" : [ + [ "Perl", 2 ] @@ -239,6 +253,16 @@ ], "id" : "W. Luis Mochan", "name" : "W. Luis Mochan" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Yitzchak Scott-Thoennes", + "name" : "Yitzchak Scott-Thoennes" } ] }, @@ -274,6 +298,11 @@ "y" : 2 }, { + "drilldown" : "Arne Sommer", + "name" : "Arne Sommer", + "y" : 3 + }, + { "drilldown" : "David Ferrone", "name" : "David Ferrone", "y" : 2 @@ -357,13 +386,18 @@ "drilldown" : "W. Luis Mochan", "name" : "W. Luis Mochan", "y" : 3 + }, + { + "drilldown" : "Yitzchak Scott-Thoennes", + "name" : "Yitzchak Scott-Thoennes", + "y" : 2 } ], "name" : "The Weekly Challenge - 331" } ], "subtitle" : { - "text" : "[Champions: 20] Last updated at 2025-07-23 18:42:21 GMT" + "text" : "[Champions: 22] Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge - 331" diff --git a/stats/pwc-language-breakdown-2019.json b/stats/pwc-language-breakdown-2019.json index 81f224bbf4..aa3facf8f2 100644 --- a/stats/pwc-language-breakdown-2019.json +++ b/stats/pwc-language-breakdown-2019.json @@ -970,7 +970,7 @@ } ], "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-07-23 18:42:21 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge Language" diff --git a/stats/pwc-language-breakdown-2020.json b/stats/pwc-language-breakdown-2020.json index 8f05239412..002f3ee2a0 100644 --- a/stats/pwc-language-breakdown-2020.json +++ b/stats/pwc-language-breakdown-2020.json @@ -1223,7 +1223,7 @@ } ], "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-07-23 18:42:21 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge Language" diff --git a/stats/pwc-language-breakdown-2021.json b/stats/pwc-language-breakdown-2021.json index d63c861ee7..0473b8cfce 100644 --- a/stats/pwc-language-breakdown-2021.json +++ b/stats/pwc-language-breakdown-2021.json @@ -1223,7 +1223,7 @@ } ], "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-07-23 18:42:21 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge Language" diff --git a/stats/pwc-language-breakdown-2022.json b/stats/pwc-language-breakdown-2022.json index f09aec24a4..be0267ead1 100644 --- a/stats/pwc-language-breakdown-2022.json +++ b/stats/pwc-language-breakdown-2022.json @@ -1223,7 +1223,7 @@ } ], "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-07-23 18:42:21 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge Language" diff --git a/stats/pwc-language-breakdown-2023.json b/stats/pwc-language-breakdown-2023.json index 9b9c50f96b..81aadc87ff 100644 --- a/stats/pwc-language-breakdown-2023.json +++ b/stats/pwc-language-breakdown-2023.json @@ -1200,7 +1200,7 @@ } ], "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-07-23 18:42:21 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge Language" diff --git a/stats/pwc-language-breakdown-2024.json b/stats/pwc-language-breakdown-2024.json index 1ad40b38bc..1304738512 100644 --- a/stats/pwc-language-breakdown-2024.json +++ b/stats/pwc-language-breakdown-2024.json @@ -1246,7 +1246,7 @@ } ], "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-07-23 18:42:21 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge Language" diff --git a/stats/pwc-language-breakdown-2025.json b/stats/pwc-language-breakdown-2025.json index 0412ac8389..9dff469ffa 100644 --- a/stats/pwc-language-breakdown-2025.json +++ b/stats/pwc-language-breakdown-2025.json @@ -8,15 +8,15 @@ "data" : [ [ "Perl", - 32 + 34 ], [ "Raku", - 14 + 16 ], [ "Blog", - 7 + 8 ] ], "id" : "331", @@ -547,7 +547,7 @@ { "drilldown" : "331", "name" : "331", - "y" : 53 + "y" : 58 }, { "drilldown" : "330", @@ -694,7 +694,7 @@ } ], "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-07-23 18:42:21 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge Language" diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index e65a3b3c53..5488050613 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -10,15 +10,15 @@ "data" : [ [ "Perl", - 17086 + 17088 ], [ "Raku", - 9509 + 9511 ], [ "Blog", - 6115 + 6116 ] ], "dataLabels" : { @@ -37,7 +37,7 @@ } ], "subtitle" : { - "text" : "Last updated at 2025-07-23 18:42:21 GMT" + "text" : "Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge Contributions [2019 - 2025]" diff --git a/stats/pwc-leaders.json b/stats/pwc-leaders.json index b0d81e744c..7ab0d09124 100644 --- a/stats/pwc-leaders.json +++ b/stats/pwc-leaders.json @@ -80,11 +80,11 @@ ], [ "Raku", - 657 + 659 ], [ "Blog", - 329 + 330 ] ], "id" : "Arne Sommer", @@ -817,7 +817,7 @@ { "drilldown" : "Arne Sommer", "name" : "5: Arne Sommer", - "y" : 2278 + "y" : 2284 }, { "drilldown" : "Athanasius", @@ -1049,7 +1049,7 @@ } ], "subtitle" : { - "text" : "Click the columns to drilldown the score breakdown. Last updated at 2025-07-23 18:42:21 GMT" + "text" : "Click the columns to drilldown the score breakdown. Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "Team Leaders (TOP 50)" diff --git a/stats/pwc-summary-1-30.json b/stats/pwc-summary-1-30.json index 76acd9d2eb..4c0c0cb228 100644 --- a/stats/pwc-summary-1-30.json +++ b/stats/pwc-summary-1-30.json @@ -72,7 +72,7 @@ 0, 0, 2, - 657, + 659, 0, 21 ], @@ -107,7 +107,7 @@ 0, 0, 0, - 329, + 330, 0, 0 ], @@ -115,7 +115,7 @@ } ], "subtitle" : { - "text" : "[Champions: 30] Last updated at 2025-07-23 18:42:21 GMT" + "text" : "[Champions: 30] Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge [2019 - 2025]" diff --git a/stats/pwc-summary-121-150.json b/stats/pwc-summary-121-150.json index 684d81ca61..ac1509f595 100644 --- a/stats/pwc-summary-121-150.json +++ b/stats/pwc-summary-121-150.json @@ -115,7 +115,7 @@ } ], "subtitle" : { - "text" : "[Champions: 30] Last updated at 2025-07-23 18:42:21 GMT" + "text" : "[Champions: 30] Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge [2019 - 2025]" diff --git a/stats/pwc-summary-151-180.json b/stats/pwc-summary-151-180.json index 3bb2164dc8..9bbf009f7f 100644 --- a/stats/pwc-summary-151-180.json +++ b/stats/pwc-summary-151-180.json @@ -115,7 +115,7 @@ } ], "subtitle" : { - "text" : "[Champions: 30] Last updated at 2025-07-23 18:42:21 GMT" + "text" : "[Champions: 30] Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge [2019 - 2025]" diff --git a/stats/pwc-summary-181-210.json b/stats/pwc-summary-181-210.json index 0ea91a414f..bde52174c1 100644 --- a/stats/pwc-summary-181-210.json +++ b/stats/pwc-summary-181-210.json @@ -115,7 +115,7 @@ } ], "subtitle" : { - "text" : "[Champions: 30] Last updated at 2025-07-23 18:42:21 GMT" + "text" : "[Champions: 30] Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge [2019 - 2025]" diff --git a/stats/pwc-summary-211-240.json b/stats/pwc-summary-211-240.json index f5fbc161f6..73e3463b64 100644 --- a/stats/pwc-summary-211-240.json +++ b/stats/pwc-summary-211-240.json @@ -115,7 +115,7 @@ } ], "subtitle" : { - "text" : "[Champions: 30] Last updated at 2025-07-23 18:42:21 GMT" + "text" : "[Champions: 30] Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge [2019 - 2025]" diff --git a/stats/pwc-summary-241-270.json b/stats/pwc-summary-241-270.json index bdb1a011ee..30ef9950fc 100644 --- a/stats/pwc-summary-241-270.json +++ b/stats/pwc-summary-241-270.json @@ -115,7 +115,7 @@ } ], "subtitle" : { - "text" : "[Champions: 30] Last updated at 2025-07-23 18:42:21 GMT" + "text" : "[Champions: 30] Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge [2019 - 2025]" diff --git a/stats/pwc-summary-271-300.json b/stats/pwc-summary-271-300.json index ad52ac9382..b4d8867d0a 100644 --- a/stats/pwc-summary-271-300.json +++ b/stats/pwc-summary-271-300.json @@ -115,7 +115,7 @@ } ], "subtitle" : { - "text" : "[Champions: 30] Last updated at 2025-07-23 18:42:21 GMT" + "text" : "[Champions: 30] Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge [2019 - 2025]" diff --git a/stats/pwc-summary-301-330.json b/stats/pwc-summary-301-330.json index 923fb1986c..8d010b7a78 100644 --- a/stats/pwc-summary-301-330.json +++ b/stats/pwc-summary-301-330.json @@ -34,7 +34,7 @@ 3, 3, 85, - 18, + 20, 21, 8 ], @@ -106,7 +106,7 @@ } ], "subtitle" : { - "text" : "[Champions: 27] Last updated at 2025-07-23 18:42:21 GMT" + "text" : "[Champions: 27] Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge [2019 - 2025]" diff --git a/stats/pwc-summary-31-60.json b/stats/pwc-summary-31-60.json index bc2ff816c6..1a45caee54 100644 --- a/stats/pwc-summary-31-60.json +++ b/stats/pwc-summary-31-60.json @@ -69,8 +69,8 @@ 9, 0, 0, - 2, 17, + 2, 0, 194, 0, @@ -115,7 +115,7 @@ } ], "subtitle" : { - "text" : "[Champions: 30] Last updated at 2025-07-23 18:42:21 GMT" + "text" : "[Champions: 30] Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge [2019 - 2025]" diff --git a/stats/pwc-summary-61-90.json b/stats/pwc-summary-61-90.json index 8075f30cf3..02b23be63e 100644 --- a/stats/pwc-summary-61-90.json +++ b/stats/pwc-summary-61-90.json @@ -115,7 +115,7 @@ } ], "subtitle" : { - "text" : "[Champions: 30] Last updated at 2025-07-23 18:42:21 GMT" + "text" : "[Champions: 30] Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge [2019 - 2025]" diff --git a/stats/pwc-summary-91-120.json b/stats/pwc-summary-91-120.json index f28ec87694..d4158fec02 100644 --- a/stats/pwc-summary-91-120.json +++ b/stats/pwc-summary-91-120.json @@ -115,7 +115,7 @@ } ], "subtitle" : { - "text" : "[Champions: 30] Last updated at 2025-07-23 18:42:21 GMT" + "text" : "[Champions: 30] Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge [2019 - 2025]" diff --git a/stats/pwc-summary.json b/stats/pwc-summary.json index a091e0746e..e5a1cc5af3 100644 --- a/stats/pwc-summary.json +++ b/stats/pwc-summary.json @@ -334,7 +334,7 @@ 3, 3, 44, - 9, + 10, 11, 4 ], @@ -369,7 +369,7 @@ 0, 0, 1, - 329, + 330, 0, 12, 280, @@ -701,7 +701,7 @@ 0, 0, 0, - 329, + 330, 0, 0, 4, @@ -1006,7 +1006,7 @@ } ], "subtitle" : { - "text" : "[Champions: 327] Last updated at 2025-07-23 18:42:21 GMT" + "text" : "[Champions: 327] Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge [2019 - 2025]" diff --git a/stats/pwc-yearly-language-summary.json b/stats/pwc-yearly-language-summary.json index 099e3f9eb9..22dd2f3411 100644 --- a/stats/pwc-yearly-language-summary.json +++ b/stats/pwc-yearly-language-summary.json @@ -8,15 +8,15 @@ "data" : [ [ "Perl", - 1315 + 1317 ], [ "Raku", - 639 + 641 ], [ "Blog", - 536 + 537 ] ], "id" : "2025", @@ -151,7 +151,7 @@ { "drilldown" : "2025", "name" : "2025", - "y" : 2490 + "y" : 2495 }, { "drilldown" : "2024", @@ -188,7 +188,7 @@ } ], "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-07-23 18:42:21 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2025-07-23 21:29:25 GMT" }, "title" : { "text" : "The Weekly Challenge Language" |
