diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2020-06-01 08:48:46 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2020-06-01 08:48:46 +0100 |
| commit | 9fe5458ca91950618dadde71f082b6feb4ba8940 (patch) | |
| tree | fc62358b4e818b4b6dd888c99945fd7b09697f5c | |
| parent | 357bb1ed666a956d548238d83c1a87c0b84e213f (diff) | |
| download | perlweeklychallenge-club-9fe5458ca91950618dadde71f082b6feb4ba8940.tar.gz perlweeklychallenge-club-9fe5458ca91950618dadde71f082b6feb4ba8940.tar.bz2 perlweeklychallenge-club-9fe5458ca91950618dadde71f082b6feb4ba8940.zip | |
- Added solutions by Javier Luque.
| -rw-r--r-- | challenge-063/javier-luque/blog.txt | 1 | ||||
| -rw-r--r-- | challenge-063/javier-luque/perl/ch-1.pl | 25 | ||||
| -rw-r--r-- | challenge-063/javier-luque/perl/ch-2.pl | 29 | ||||
| -rw-r--r-- | challenge-063/javier-luque/raku/ch-1.p6 | 25 | ||||
| -rw-r--r-- | challenge-063/javier-luque/raku/ch-2.p6 | 26 | ||||
| -rw-r--r-- | stats/pwc-current.json | 83 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 78 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 968 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 388 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 34 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 92 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 48 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 120 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 36 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 106 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 58 |
16 files changed, 1123 insertions, 994 deletions
diff --git a/challenge-063/javier-luque/blog.txt b/challenge-063/javier-luque/blog.txt new file mode 100644 index 0000000000..f7d838f037 --- /dev/null +++ b/challenge-063/javier-luque/blog.txt @@ -0,0 +1 @@ +https://perlchallenges.wordpress.com/2020/06/01/perl-weekly-challenge-063/ diff --git a/challenge-063/javier-luque/perl/ch-1.pl b/challenge-063/javier-luque/perl/ch-1.pl new file mode 100644 index 0000000000..c37b7e57a5 --- /dev/null +++ b/challenge-063/javier-luque/perl/ch-1.pl @@ -0,0 +1,25 @@ +#!/usr/bin/perl +# Test: ./ch-1.pl -u +use strict; +use warnings; +use feature qw /say/; +use Test::More; + +is (last_word(' hello world', qr/[ea]l/), 'hello', 'Hello world'); +is (last_word("Don't match too much, Chet!", qr/ch.t/i), 'Chet!', 'Chet'); +is (last_word("spaces in regexp won't match", qr/in re/), undef, 'Undef'); +is (last_word( join(' ', 1..1e6), qr/^(3.*?){3}/), '399933', 'Numbers'); + +done_testing(); + +sub last_word { + my ($string, $regex) = @_; + my @words = reverse (split ('\s', $string)); + + for my $word (@words) { + return $word + if ($word =~ /$regex/); + } + + return undef; +} diff --git a/challenge-063/javier-luque/perl/ch-2.pl b/challenge-063/javier-luque/perl/ch-2.pl new file mode 100644 index 0000000000..7c158df528 --- /dev/null +++ b/challenge-063/javier-luque/perl/ch-2.pl @@ -0,0 +1,29 @@ +#!/usr/bin/perl +# Test: ./ch-2.pl +use strict; +use warnings; +use feature qw /say/; + +say rotate('xyxx') . ' rotations'; + +sub rotate { + my $word = shift; + my $copy = $word; + + # The total length of the word + my $total_word_length = length($word); + my $i = 0; + + do { + $i++; + my $position = $i % $total_word_length; + my $length = $total_word_length - $position; + + $copy = (substr $copy, $position, $length) . + (substr $copy, 0, $position); + + say "Rotation $i: $copy"; + } while ($copy ne $word); + + return $i; +} diff --git a/challenge-063/javier-luque/raku/ch-1.p6 b/challenge-063/javier-luque/raku/ch-1.p6 new file mode 100644 index 0000000000..b880054e44 --- /dev/null +++ b/challenge-063/javier-luque/raku/ch-1.p6 @@ -0,0 +1,25 @@ +# Test: perl6 ch-1.p6 -u +use Test; + +# Hash to store unique emails +my %unique_emails; + +sub MAIN() { + is last_word(' hello world', rx/[e|a]l/), 'hello', 'Hello world'; + is last_word("Don't match too much, Chet!", rx:i/ch.t/), 'Chet!', 'Chet'; + is last_word("spaces in regexp won't match", rx/"in re"/), Nil, 'Undef'; + is last_word( join(' ', 1..1e6), rx/^^(3.*?)**3/), '399933', 'Numbers'; + done-testing; +} + +# Check if the email is unique +sub last_word(Str $string, $regex) { + my @words = $string.split(/\s/).reverse; + + for (@words) -> $word { + return $word + if ($word ~~ $regex); + } + + return Nil; +} diff --git a/challenge-063/javier-luque/raku/ch-2.p6 b/challenge-063/javier-luque/raku/ch-2.p6 new file mode 100644 index 0000000000..0a8d92fdc3 --- /dev/null +++ b/challenge-063/javier-luque/raku/ch-2.p6 @@ -0,0 +1,26 @@ +# Test: perl6 ch-2.p6 + +sub MAIN() { + say rotate('xyxx') ~ ' rotations'; +} + +sub rotate(Str $word) { + my $copy = $word; + + # The total length of the word + my $total_word_length = $word.chars; + my $i = 0; + + repeat { + $i++; + my $position = $i % $total_word_length; + my $length = $total_word_length - $position; + + $copy = $copy.substr($position, $length) ~ + $copy.substr(0, $position); + + say "Rotation $i: $copy"; + } while ($copy ne $word); + + return $i; +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 10649fd5ab..2946229cc3 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,63 +1,86 @@ { - "xAxis" : { - "type" : "category" + "plotOptions" : { + "series" : { + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + }, + "borderWidth" : 0 + } }, - "tooltip" : { - "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>", - "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>", - "followPointer" : 1 + "chart" : { + "type" : "column" }, "drilldown" : { "series" : [ { - "id" : "Niels van Dijke", "data" : [ [ "Perl", 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 ] ], + "id" : "Javier Luque", + "name" : "Javier Luque" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Niels van Dijke", "name" : "Niels van Dijke" } ] }, - "chart" : { - "type" : "column" - }, - "plotOptions" : { - "series" : { - "borderWidth" : 0, - "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - } - } - }, - "subtitle" : { - "text" : "[Champions: 1] Last updated at 2020-06-01 06:59:18 GMT" - }, - "legend" : { - "enabled" : 0 - }, - "title" : { - "text" : "Perl Weekly Challenge - 063" - }, "series" : [ { + "name" : "Perl Weekly Challenge - 063", "data" : [ { + "drilldown" : "Javier Luque", + "name" : "Javier Luque", + "y" : 5 + }, + { "drilldown" : "Niels van Dijke", "name" : "Niels van Dijke", "y" : 2 } ], - "colorByPoint" : 1, - "name" : "Perl Weekly Challenge - 063" + "colorByPoint" : 1 } ], + "xAxis" : { + "type" : "category" + }, + "tooltip" : { + "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>", + "followPointer" : 1, + "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>" + }, + "legend" : { + "enabled" : 0 + }, + "title" : { + "text" : "Perl Weekly Challenge - 063" + }, "yAxis" : { "title" : { "text" : "Total Solutions" } + }, + "subtitle" : { + "text" : "[Champions: 2] Last updated at 2020-06-01 07:48:25 GMT" } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index e03ed74310..9400854594 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,63 +1,63 @@ { - "xAxis" : { - "type" : "category", - "labels" : { - "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" - } - } - }, "tooltip" : { "pointFormat" : "<b>{point.y:.0f}</b>" }, - "chart" : { - "type" : "column" - }, - "subtitle" : { - "text" : "Last updated at 2020-06-01 06:59:18 GMT" - }, - "legend" : { - "enabled" : "false" - }, - "title" : { - "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" - }, "series" : [ { + "dataLabels" : { + "align" : "right", + "y" : 10, + "format" : "{point.y:.0f}", + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + }, + "color" : "#FFFFFF", + "rotation" : -90, + "enabled" : "true" + }, "data" : [ [ "Blog", - 715 + 716 ], [ "Perl", - 2602 + 2604 ], [ "Raku", - 1641 + 1643 ] ], - "name" : "Contributions", - "dataLabels" : { - "format" : "{point.y:.0f}", - "enabled" : "true", - "align" : "right", - "y" : 10, - "color" : "#FFFFFF", - "rotation" : -90, - "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" - } - } + "name" : "Contributions" } ], + "xAxis" : { + "type" : "category", + "labels" : { + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + } + } + }, + "chart" : { + "type" : "column" + }, + "subtitle" : { + "text" : "Last updated at 2020-06-01 07:48:25 GMT" + }, + "title" : { + "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" + }, + "legend" : { + "enabled" : "false" + }, "yAxis" : { + "min" : 0, "title" : { "text" : null - }, - "min" : 0 + } } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index eb80f2e84c..6601174c29 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,8 +1,364 @@ { + "subtitle" : { + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2020-06-01 07:48:25 GMT" + }, + "legend" : { + "enabled" : "false" + }, + "title" : { + "text" : "Perl Weekly Challenge Language" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "series" : [ + { + "colorByPoint" : "true", + "data" : [ + { + "name" : "#001", + "y" : 142, + "drilldown" : "001" + }, + { + "drilldown" : "002", + "name" : "#002", + "y" : 109 + }, + { + "name" : "#003", + "y" : 71, + "drilldown" : "003" + }, + { + "drilldown" : "004", + "name" : "#004", + "y" : 91 + }, + { + "name" : "#005", + "y" : 72, + "drilldown" : "005" + }, + { + "name" : "#006", + "y" : 52, + "drilldown" : "006" + }, + { + "name" : "#007", + "y" : 59, + "drilldown" : "007" + }, + { + "y" : 72, + "name" : "#008", + "drilldown" : "008" + }, + { + "drilldown" : "009", + "y" : 68, + "name" : "#009" + }, + { + "name" : "#010", + "y" : 60, + "drilldown" : "010" + }, + { + "drilldown" : "011", + "y" : 79, + "name" : "#011" + }, + { + "drilldown" : "012", + "y" : 83, + "name" : "#012" + }, + { + "drilldown" : "013", + "y" : 76, + "name" : "#013" + }, + { + "name" : "#014", + "y" : 96, + "drilldown" : "014" + }, + { + "y" : 93, + "name" : "#015", + "drilldown" : "015" + }, + { + "name" : "#016", + "y" : 66, + "drilldown" : "016" + }, + { + "drilldown" : "017", + "name" : "#017", + "y" : 79 + }, + { + "drilldown" : "018", + "name" : "#018", + "y" : 76 + }, + { + "drilldown" : "019", + "name" : "#019", + "y" : 97 + }, + { + "drilldown" : "020", + "name" : "#020", + "y" : 95 + }, + { + "y" : 67, + "name" : "#021", + "drilldown" : "021" + }, + { + "name" : "#022", + "y" : 63, + "drilldown" : "022" + }, + { + "y" : 91, + "name" : "#023", + "drilldown" : "023" + }, + { + "y" : 70, + "name" : "#024", + "drilldown" : "024" + }, + { + "drilldown" : "025", + "name" : "#025", + "y" : 55 + }, + { + "drilldown" : "026", + "y" : 70, + "name" : "#026" + }, + { + "name" : "#027", + "y" : 58, + "drilldown" : "027" + }, + { + "drilldown" : "028", + "name" : "#028", + "y" : 78 + }, + { + "drilldown" : "029", + "y" : 77, + "name" : "#029" + }, + { + "drilldown" : "030", + "name" : "#030", + "y" : 115 + }, + { + "drilldown" : "031", + "name" : "#031", + "y" : 87 + }, + { + "drilldown" : "032", + "name" : "#032", + "y" : 92 + }, + { + "name" : "#033", + "y" : 108, + "drilldown" : "033" + }, + { + "name" : "#034", + "y" : 62, + "drilldown" : "034" + }, + { + "drilldown" : "035", + "y" : 62, + "name" : "#035" + }, + { + "y" : 66, + "name" : "#036", + "drilldown" : "036" + }, + { + "name" : "#037", + "y" : 65, + "drilldown" : "037" + }, + { + "y" : 65, + "name" : "#038", + "drilldown" : "038" + }, + { + "y" : 60, + "name" : "#039", + "drilldown" : "039" + }, + { + "y" : 71, + "name" : "#040", + "drilldown" : "040" + }, + { + "drilldown" : "041", + "name" : "#041", + "y" : 74 + }, + { + "y" : 88, + "name" : "#042", + "drilldown" : "042" + }, + { + "drilldown" : "043", + "name" : "#043", + "y" : 66 + }, + { + "drilldown" : "044", + "y" : 82, + "name" : "#044" + }, + { + "y" : 94, + "name" : "#045", + "drilldown" : "045" + }, + { + "drilldown" : "046", + "y" : 85, + "name" : "#046" + }, + { + "y" : 82, + "name" : "#047", + "drilldown" : "047" + }, + { + "name" : "#048", + "y" : 106, + "drilldown" : "048" + }, + { + "drilldown" : "049", + "name" : "#049", + "y" : 85 + }, + { + "drilldown" : "050", + "name" : "#050", + "y" : 96 + }, + { + "drilldown" : "051", + "name" : "#051", + "y" : 87 + }, + { + "drilldown" : "052", + "name" : "#052", + "y" : 89 + }, + { + "drilldown" : "053", + "name" : "#053", + "y" : 99 + }, + { + "y" : 99, + "name" : "#054", + "drilldown" : "054" + }, + { + "drilldown" : "055", + "y" : 86, + "name" : "#055" + }, + { + "name" : "#056", + "y" : 93, + "drilldown" : "056" + }, + { + "y" : 78, + "name" : "#057", + "drilldown" : "057" + }, + { + "drilldown" : "058", + "y" : 61, + "name" : "#058" + }, + { + "name" : "#059", + "y" : 82, + "drilldown" : "059" + }, + { + "y" : 78, + "name" : "#060", + "drilldown" : "060" + }, + { + "y" : 78, + "name" : "#061", + "drilldown" : "061" + }, + { + "y" : 50, + "name" : "#062", + "drilldown" : "062" + }, + { + "y" : 7, + "name" : "#063", + "drilldown" : "063" + } + ], + "name" : "Perl Weekly Challenge Languages" + } + ], + "xAxis" : { + "type" : "category" + }, + "tooltip" : { + "followPointer" : "true", + "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>", + "headerFormat" : "<span style=\"font-size:11px\"></span>" + }, + "plotOptions" : { + "series" : { + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + }, + "borderWidth" : 0 + } + }, + "chart" : { + "type" : "column" + }, "drilldown" : { "series" : [ { - "id" : "001", "data" : [ [ "Perl", @@ -17,11 +373,12 @@ 11 ] ], - "name" : "001" + "name" : "001", + "id" : "001" }, { - "name" : "002", "id" : "002", + "name" : "002", "data" : [ [ "Perl", @@ -38,6 +395,7 @@ ] }, { + "id" : "003", "name" : "003", "data" : [ [ @@ -52,10 +410,10 @@ "Blog", 9 ] - ], - "id" : "003" + ] }, { + "id" : "004", "name" : "004", "data" : [ [ @@ -70,12 +428,9 @@ "Blog", 10 ] - ], - "id" : "004" + ] }, { - "name" : "005", - "id" : "005", "data" : [ [ "Perl", @@ -89,10 +444,11 @@ "Blog", 12 ] - ] + ], + "name" : "005", + "id" : "005" }, { - "name" : "006", "data" : [ [ "Perl", @@ -107,11 +463,10 @@ 7 ] ], - "id" : "006" + "id" : "006", + "name" : "006" }, { - "name" : "007", - "id" : "007", "data" : [ [ "Perl", @@ -125,9 +480,12 @@ "Blog", 10 ] - ] + ], + "name" : "007", + "id" : "007" }, { + "id" : "008", "name" : "008", "data" : [ [ @@ -142,11 +500,11 @@ "Blog", 12 ] - ], - "id" : "008" + ] }, { "name" : "009", + "id" : "009", "data" : [ [ "Perl", @@ -160,10 +518,10 @@ "Blog", 13 ] - ], - "id" : "009" + ] }, { + "name" : "010", "id" : "010", "data" : [ [ @@ -178,12 +536,9 @@ "Blog", 11 ] - ], - "name" : "010" + ] }, { - "name" : "011", - "id" : "011", "data" : [ [ "Perl", @@ -197,10 +552,13 @@ "Blog", 10 ] - ] + ], + "name" : "011", + "id" : "011" }, { "id" : "012", + "name" : "012", "data" : [ [ "Perl", @@ -214,10 +572,11 @@ "Blog", 11 ] - ], - "name" : "012" + ] }, { + "name" : "013", + "id" : "013", "data" : [ [ "Perl", @@ -231,13 +590,11 @@ "Blog", 13 ] - ], - "id" : "013", - "name" : "013" + ] }, { - "name" : "014", "id" : "014", + "name" : "014", "data" : [ [ "Perl", @@ -254,8 +611,8 @@ ] }, { - "name" : "015", "id" : "015", + "name" : "015", "data" : [ [ "Perl", @@ -272,6 +629,8 @@ ] }, { + "id" : "016", + "name" : "016", "data" : [ [ "Perl", @@ -285,12 +644,9 @@ "Blog", 12 ] - ], - "id" : "016", - "name" : "016" + ] }, { - "name" : "017", "data" : [ [ "Perl", @@ -305,10 +661,10 @@ 12 ] ], + "name" : "017", "id" : "017" }, { - "id" : "018", "data" : [ [ "Perl", @@ -323,11 +679,12 @@ 14 ] ], - "name" : "018" + "name" : "018", + "id" : "018" }, { - "name" : "019", "id" : "019", + "name" : "019", "data" : [ [ "Perl", @@ -344,7 +701,6 @@ ] }, { - "id" : "020", "data" : [ [ "Perl", @@ -359,9 +715,12 @@ 13 ] ], + "id" : "020", "name" : "020" }, { + "id" : "021", + "name" : "021", "data" : [ [ "Perl", @@ -375,12 +734,9 @@ "Blog", 10 ] - ], - "id" : "021", - "name" : "021" + ] }, { - "id" : "022", "data" : [ [ "Perl", @@ -395,10 +751,12 @@ 10 ] ], - "name" : "022" + "name" : "022", + "id" : "022" }, { "id" : "023", + "name" : "023", "data" : [ [ "Perl", @@ -412,11 +770,11 @@ "Blog", 12 ] - ], - "name" : "023" + ] }, { "id" : "024", + "name" : "024", "data" : [ [ "Perl", @@ -430,11 +788,9 @@ "Blog", 11 ] - ], - "name" : "024" + ] }, { - "id" : "025", "data" : [ [ "Perl", @@ -449,9 +805,11 @@ 12 ] ], + "id" : "025", "name" : "025" }, { + "id" : "026", "name" : "026", "data" : [ [ @@ -466,11 +824,9 @@ "Blog", 10 ] - ], - "id" : "026" + ] }, { - "id" : "027", "data" : [ [ "Perl", @@ -485,11 +841,12 @@ 9 ] ], - "name" : "027" + "name" : "027", + "id" : "027" }, { - "name" : "028", "id" : "028", + "name" : "028", "data" : [ [ "Perl", @@ -524,7 +881,6 @@ "name" : "029" }, { - "name" : "030", "data" : [ [ "Perl", @@ -539,6 +895,7 @@ 10 ] ], + "name" : "030", "id" : "030" }, { @@ -560,6 +917,7 @@ "name" : " |
