diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2019-05-06 10:57:02 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2019-05-06 10:57:02 +0100 |
| commit | fd8a0cd68fb82de2c47ac6c5bce906eb0544971c (patch) | |
| tree | d9aaeba462b8eb34979425c5b9299bdeba40518c | |
| parent | b03e18fe3937b41eb42938ac8f2546d3b4586aab (diff) | |
| download | perlweeklychallenge-club-fd8a0cd68fb82de2c47ac6c5bce906eb0544971c.tar.gz perlweeklychallenge-club-fd8a0cd68fb82de2c47ac6c5bce906eb0544971c.tar.bz2 perlweeklychallenge-club-fd8a0cd68fb82de2c47ac6c5bce906eb0544971c.zip | |
- Updated chart data for Arne Sommer.
| -rw-r--r-- | challenge-006/arne-sommer/blog.txt | 1 | ||||
| -rw-r--r-- | challenge-006/arne-sommer/perl6/ch-1.p6 | 56 | ||||
| -rw-r--r-- | challenge-006/arne-sommer/perl6/ch-1a.p6 | 55 | ||||
| -rw-r--r-- | challenge-006/arne-sommer/perl6/ch-2.p6 | 12 | ||||
| -rw-r--r-- | stats/pwc-challenge-006.json | 17 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 108 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 480 | ||||
| -rw-r--r-- | stats/pwc-master-stats.json | 34 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 2 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 2 |
10 files changed, 453 insertions, 314 deletions
diff --git a/challenge-006/arne-sommer/blog.txt b/challenge-006/arne-sommer/blog.txt new file mode 100644 index 0000000000..9e3c561c2d --- /dev/null +++ b/challenge-006/arne-sommer/blog.txt @@ -0,0 +1 @@ +https://perl6.eu/int-erval.html diff --git a/challenge-006/arne-sommer/perl6/ch-1.p6 b/challenge-006/arne-sommer/perl6/ch-1.p6 new file mode 100644 index 0000000000..30541bc8d9 --- /dev/null +++ b/challenge-006/arne-sommer/perl6/ch-1.p6 @@ -0,0 +1,56 @@ +unit sub MAIN (Str $values); + +my @values = $values.split(","); + +die "Integers only!" if @values.grep(/\D/); +die "Wrong order!" unless [<] @values; + +my @result; + +my @current = @values.shift; # [1] + +while @values # [2] +{ + my $next = @values.shift; # [2] + if $next == @current[* -1] + 1 + { + @current.push($next); # [3] + } + else + { + @result.push(fix-it(@current)); # [4] + @current = $next; # [4] + } +} + +@result.push(fix-it(@current)) if @current.elems; # [5] + +say @result.join(","); # [6] + +sub fix-it (@list) # [7] +{ + return @list[0] if @list.elems == 1; # [8] + return "@list[0],@list[1]" if @list.elems == 2; # [9] + return "@list[0]-@list[*-1]" if @list.elems > 2; # [10] +} + +__END__ +[1] We start with the first value (in @current). + +[2] And continue as long as there are more values in the list (placed in $next). + +[3] If the next value is one after the previuos one (the next integer value), we add it to @current. + +[4] If not, the @current array is added to the @result list. And we reset the @current array. + +[5] Finally (when we run out of new values), we add the last ones to the @result list. + +[6] Add a comma between the value groups. + +[7] This procedure fixes a list of (consecutive) integers; + +[8] if one integer, print it. + +[9] if two integers, print them with a comma in between. + +[10] if more than two integers, print the first and last with a dash in between. diff --git a/challenge-006/arne-sommer/perl6/ch-1a.p6 b/challenge-006/arne-sommer/perl6/ch-1a.p6 new file mode 100644 index 0000000000..0cfeeb7346 --- /dev/null +++ b/challenge-006/arne-sommer/perl6/ch-1a.p6 @@ -0,0 +1,55 @@ +unit sub MAIN (Str $values); + +my @values = $values.split(","); + +die "Integers only!" if @values.grep(/\D/); +die "Wrong order!" unless [<] @values; + +my $result := gather # [1] +{ + my @current = @values.shift; + + while @values + { + my $next = @values.shift; + if $next == @current[* -1] + 1 + { + @current.push($next); + } + else + { + take fix-it(@current); # [2] + @current = $next; + } + } + + take fix-it(@current) if @current.elems; # [3] +} + +say $result.join(","); # [4] + +multi sub fix-it (@list where @list.elems == 1) # [5] +{ + return @list[0]; +} + +multi sub fix-it (@list where @list.elems == 2) # [5] +{ + return "@list[0],@list[1]"; +} + +multi sub fix-it (@list where @list.elems > 2) # [5] +{ + return "@list[0]-@list[*-1]"; +} + +__END__ +[1] We use «gather» (with binding; «:=») to set up the supply of values, as a lazy data structure (where the values are only calculated when actually needed). + +[2] We use «take» to deliver a value to the consuming part of the program. + +[3] A final «take», if we have any values left in the pipeline. + +[4] Calling «$result» like this fetches all the values at the same time. + +[5] I have chosen Multiple dispatch with «multi sub» and different signatures instead of the «if» conditions in the original version. diff --git a/challenge-006/arne-sommer/perl6/ch-2.p6 b/challenge-006/arne-sommer/perl6/ch-2.p6 new file mode 100644 index 0000000000..58a5be9140 --- /dev/null +++ b/challenge-006/arne-sommer/perl6/ch-2.p6 @@ -0,0 +1,12 @@ +use v6; + +sub FatRatRoot (Int $int where $int > 0, :$precision = 10) +{ + my @x = + FatRat.new(1, 1), + -> $x { $x - ($x ** 2 - $int) / (2 * $x) } ... *; + + return @x[$precision]; +} + +say $e ** ($pi * FatRatRoot(163)); diff --git a/stats/pwc-challenge-006.json b/stats/pwc-challenge-006.json index 291ea38484..b56e79bb19 100644 --- a/stats/pwc-challenge-006.json +++ b/stats/pwc-challenge-006.json @@ -32,6 +32,16 @@ ] }, { + "name" : "Arne Sommer", + "id" : "Arne Sommer", + "data" : [ + [ + "Perl 6", + 2 + ] + ] + }, + { "name" : "Arpad Toth", "id" : "Arpad Toth", "data" : [ @@ -210,7 +220,7 @@ ] }, "subtitle" : { - "text" : "[Champions: 19] Last updated at 2019-05-06 01:06:10 GMT" + "text" : "[Champions: 20] Last updated at 2019-05-06 01:06:10 GMT" }, "series" : [ { @@ -233,6 +243,11 @@ "y" : 2 }, { + "drilldown" : "Arne Sommer", + "name" : "Arne Sommer", + "y" : 2 + }, + { "drilldown" : "Arpad Toth", "name" : "Arpad Toth", "y" : 1 diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 189ad21575..251f08d4b6 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,17 +1,28 @@ { - "plotOptions" : { - "series" : { - "borderWidth" : 0, - "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - } + "legend" : { + "enabled" : "false" + }, + "xAxis" : { + "type" : "category" + }, + "chart" : { + "type" : "column" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" } }, + "tooltip" : { + "pointFormat" : "<span style=\"color:{point.color}\">{point.name}</span>: <b>{point.y:f}</b><br/>", + "headerFormat" : "<span style=\"font-size:11px\"></span>", + "followPointer" : "true" + }, "drilldown" : { "series" : [ { "name" : "001", + "id" : "001", "data" : [ [ "Perl 5", @@ -21,8 +32,7 @@ "Perl 6", 37 ] - ], - "id" : "001" + ] }, { "data" : [ @@ -35,12 +45,10 @@ 32 ] ], - "id" : "002", - "name" : "002" + "name" : "002", + "id" : "002" }, { - "name" : "003", - "id" : "003", "data" : [ [ "Perl 5", @@ -50,10 +58,11 @@ "Perl 6", 26 ] - ] + ], + "name" : "003", + "id" : "003" }, { - "name" : "004", "data" : [ [ "Perl 5", @@ -64,6 +73,7 @@ 29 ] ], + "name" : "004", "id" : "004" }, { @@ -90,13 +100,11 @@ ], [ "Perl 6", - 12 + 14 ] ] }, { - "name" : "007", - "id" : "007", "data" : [ [ "Perl 5", @@ -106,42 +114,48 @@ "Perl 6", 1 ] - ] + ], + "id" : "007", + "name" : "007" } ] }, + "title" : { + "text" : "Perl Weekly Challenge Language" + }, "series" : [ { + "name" : "Perl Weekly Challenge Languages", "data" : [ { - "name" : "#001 [P5=76 P6=37]", "y" : 113, + "name" : "#001 [P5=76 P6=37]", "drilldown" : "001" }, { "drilldown" : "002", - "y" : 95, - "name" : "#002 [P5=63 P6=32]" + "name" : "#002 [P5=63 P6=32]", + "y" : 95 }, { + "drilldown" : "003", "name" : "#003 [P5=32 P6=26]", - "y" : 58, - "drilldown" : "003" + "y" : 58 }, { - "y" : 75, "drilldown" : "004", - "name" : "#004 [P5=46 P6=29]" + "name" : "#004 [P5=46 P6=29]", + "y" : 75 }, { - "name" : "#005 [P5=33 P6=22]", "y" : 55, + "name" : "#005 [P5=33 P6=22]", "drilldown" : "005" }, { - "drilldown" : "006", - "y" : 39, - "name" : "#006 [P5=27 P6=12]" + "y" : 41, + "name" : "#006 [P5=27 P6=14]", + "drilldown" : "006" }, { "name" : "#007 [P5=0 P6=1]", @@ -149,33 +163,19 @@ "drilldown" : "007" } ], - "colorByPoint" : "true", - "name" : "Perl Weekly Challenge Languages" + "colorByPoint" : "true" } ], - "chart" : { - "type" : "column" - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2019-05-06 07:55:47 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2019-05-06 09:36:32 GMT" }, - "legend" : { - "enabled" : "false" - }, - "tooltip" : { - "headerFormat" : "<span style=\"font-size:11px\"></span>", - "pointFormat" : "<span style=\"color:{point.color}\">{point.name}</span>: <b>{point.y:f}</b><br/>", - "followPointer" : "true" - }, - "xAxis" : { - "type" : "category" - }, - "title" : { - "text" : "Perl Weekly Challenge Language" + "plotOptions" : { + "series" : { + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + }, + "borderWidth" : 0 + } } } diff --git a/stats/pwc-leaders.json b/stats/pwc-leaders.json index bb30079678..19de095ddd 100644 --- a/stats/pwc-leaders.json +++ b/stats/pwc-leaders.json @@ -1,14 +1,18 @@ { - "tooltip" : { - "followPointer" : "true", - "pointFormat" : "<span style=\"color:{point.color}\">{point.name}</span>: <b>{point.y:f}</b><br/>", - "headerFormat" : "<span style=\"font-size:11px\"></span>" + "legend" : { + "enabled" : "false" }, - "subtitle" : { - "text" : "Click the columns to drilldown the score breakdown. Last updated at 2019-05-06 07:55:42 GMT" + "chart" : { + "type" : "column" }, - "xAxis" : { - "type" : "category" + "plotOptions" : { + "series" : { + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + }, + "borderWidth" : 0 + } }, "drilldown" : { "series" : [ @@ -16,22 +20,21 @@ "name" : "Laurent Rosenfeld", "data" : [ [ - "Perl 5", - 12 + "Perl 6", + 11 ], [ "Blog", 7 ], [ - "Perl 6", - 11 + "Perl 5", + 12 ] ], "id" : "Laurent Rosenfeld" }, { - "id" : "Joelle Maslak", "data" : [ [ "Perl 6", @@ -46,35 +49,36 @@ 12 ] ], - "name" : "Joelle Maslak" + "name" : "Joelle Maslak", + "id" : "Joelle Maslak" }, { - "id" : "Jaldhar H. Vyas", "data" : [ [ - "Perl 6", + "Perl 5", 12 ], [ - "Perl 5", + "Perl 6", 12 ] ], - "name" : "Jaldhar H. Vyas" + "name" : "Jaldhar H. Vyas", + "id" : "Jaldhar H. Vyas" }, { + "id" : "Ruben Westerberg", + "name" : "Ruben Westerberg", "data" : [ [ - "Perl 5", + "Perl 6", 10 ], [ - "Perl 6", + "Perl 5", 10 ] - ], - "id" : "Ruben Westerberg", - "name" : "Ruben Westerberg" + ] }, { "data" : [ @@ -83,20 +87,19 @@ 4 ], [ - "Blog", - 5 - ], - [ "Perl 6", 11 + ], + [ + "Blog", + 5 ] ], - "id" : "Simon Proctor", - "name" : "Simon Proctor" + "name" : "Simon Proctor", + "id" : "Simon Proctor" }, { "name" : "Adam Russell", - "id" : "Adam Russell", "data" : [ [ "Perl 5", @@ -106,9 +109,11 @@ "Blog", 6 ] - ] + ], + "id" : "Adam Russell" }, { + "id" : "Dr James A. Smith", "name" : "Dr James A. Smith", "data" : [ [ @@ -119,10 +124,10 @@ "Perl 5", 10 ] - ], - "id" : "Dr James A. Smith" + ] }, { + "name" : "Jo Christian Oterhals", "data" : [ [ "Blog", @@ -137,25 +142,24 @@ 6 ] ], - "id" : "Jo Christian Oterhals", - "name" : "Jo Christian Oterhals" + "id" : "Jo Christian Oterhals" }, { + "id" : "Kian-Meng Ang", + "name" : "Kian-Meng Ang", "data" : [ [ - "Perl 5", - 11 - ], - [ "Blog", 5 + ], + [ + "Perl 5", + 11 ] - ], - "id" : "Kian-Meng Ang", - "name" : "Kian-Meng Ang" + ] }, { - "name" : "Nick Logan", + "id" : "Nick Logan", "data" : [ [ "Perl 6", @@ -166,11 +170,25 @@ 8 ] ], - "id" : "Nick Logan" + "name" : "Nick Logan" + }, + { + "id" : "Arne Sommer", + "name" : "Arne Sommer", + "data" : [ + [ + "Blog", + 5 + ], + [ + "Perl 6", + 10 + ] + ] }, { - "name" : "Lars Balker", "id" : "Lars Balker", + "name" : "Lars Balker", "data" : [ [ "Perl 6", @@ -185,19 +203,20 @@ { "data" : [ [ - "Perl 5", - 9 - ], - [ "Blog", 4 + ], + [ + "Perl 5", + 9 ] ], - "id" : "Gustavo Chaves", - "name" : "Gustavo Chaves" + "name" : "Gustavo Chaves", + "id" : "Gustavo Chaves" }, { "id" : "Mark Senn", + "name" : "Mark Senn", "data" : [ [ "Perl 6", @@ -207,36 +226,21 @@ "Blog", 3 ] - ], - "name" : "Mark Senn" + ] }, { - "name" : "Andrezgz", - "id" : "Andrezgz", "data" : [ [ "Perl 5", 12 ] - ] - }, - { - "name" : "Arne Sommer", - "data" : [ - [ - "Perl 6", - 8 - ], - [ - "Blog", - 4 - ] ], - "id" : "Arne Sommer" + "name" : "Andrezgz", + "id" : "Andrezgz" }, { - "name" : "Athanasius", "id" : "Athanasius", + "name" : "Athanasius", "data" : [ [ "Perl 5", @@ -245,28 +249,28 @@ ] }, { + "id" : "Doug Schrag", "name" : "Doug Schrag", "data" : [ [ "Perl 6", 10 ] - ], - "id" : "Doug Schrag" + ] }, { - "id" : "Duncan C. White", "data" : [ [ "Perl 5", 10 ] ], - "name" : "Duncan C. White" + "name" : "Duncan C. White", + "id" : "Duncan C. White" }, { - "name" : "Francis Whittle", "id" : "Francis Whittle", + "name" : "Francis Whittle", "data" : [ [ "Perl 6", @@ -279,7 +283,6 @@ ] }, { - "name" : "Robert Gratza", "data" : [ [ "Perl 6", @@ -290,6 +293,7 @@ 2 ] ], + "name" : "Robert Gratza", "id" : "Robert Gratza" }, { @@ -303,16 +307,18 @@ "name" : "Daniel Mantovani" }, { + "id" : "John Barrett", "name" : "John Barrett", "data" : [ [ "Perl 5", 7 ] - ], - "id" : "John Barrett" + ] }, { + "id" : "E. Choroba", + "name" : "E. Choroba", "data" : [ [ "Blog", @@ -322,9 +328,7 @@ "Perl 5", 4 ] - ], - "id" : "E. Choroba", - "name" : "E. Choroba" + ] }, { "id" : "Maxim Kolodyazhny", @@ -337,17 +341,17 @@ "name" : "Maxim Kolodyazhny" }, { + "id" : "Ozzy", "data" : [ [ "Perl 6", 6 ] ], - "id" : "Ozzy", "name" : "Ozzy" }, { - "id" : "Philippe Bruhat", + "name" : "Philippe Bruhat", "data" : [ [ "Perl 5", @@ -358,7 +362,7 @@ 2 ] ], - "name" : "Philippe Bruhat" + "id" : "Philippe Bruhat" }, { "id" : "Sergio Iglesias", @@ -371,18 +375,17 @@ "name" : "Sergio Iglesias" }, { - "id" : "Arpad Toth", "data" : [ [ "Perl 5", 5 ] ], - "name" : "Arpad Toth" + "name" : "Arpad Toth", + "id" : "Arpad Toth" }, { "name" : "Khalid", - "id" : "Khalid", "data" : [ [ "Perl 5", @@ -392,10 +395,10 @@ "Blog", 1 ] - ] + ], + "id" : "Khalid" }, { - "name" : "Steve Rogerson", "data" : [ [ "Perl 6", @@ -406,77 +409,78 @@ 3 ] ], + "name" : "Steve Rogerson", "id" : "Steve Rogerson" }, { - "name" : "Veesh Goldman", "data" : [ [ "Perl 5", 5 ] ], + "name" : "Veesh Goldman", "id" : "Veesh Goldman" }, { - "id" : "Alex Daniel", "data" : [ [ "Perl 6", 4 ] ], - "name" : "Alex Daniel" + "name" : "Alex Daniel", + "id" : "Alex Daniel" }, { - "id" : "Bob Kleemann", + "name" : "Bob Kleemann", "data" : [ [ "Perl 5", 4 ] ], - "name" : "Bob Kleemann" + "id" : "Bob Kleemann" }, { + "id" : "Chenyf", + "name" : "Chenyf", "data" : [ [ "Perl 6", 4 ] - ], - "id" : "Chenyf", - "name" : "Chenyf" + ] }, { + "id" : "David Kayal", "name" : "David Kayal", "data" : [ [ "Perl 5", 4 ] - ], - "id" : "David Kayal" + ] }, { + "id" : "Jaime Corchado", "name" : "Jaime Corchado", "data" : [ [ "Perl 5", 4 ] - ], - "id" : "Jaime Corchado" + ] }, { - "name" : "Matt Latusek", + "id" : "Matt Latusek", "data" : [ [ "Perl 5", 4 ] ], - "id" : "Matt Latusek" + "name" : "Matt Latusek" }, { "name" : "Simon Reinhardt", @@ -489,34 +493,34 @@ "id" : "Simon Reinhardt" }, { - "id" : "Steven Wilson", + "name" : "Steven Wilson", "data" : [ [ "Perl 5", 4 ] ], - "name" : "Steven Wilson" + "id" : "Steven Wilson" }, { "id" : "Tim Smith", + "name" : "Tim Smith", "data" : [ [ "Perl 6", 4 ] - ], - "name" : "Tim Smith" + ] }, { + "id" : "Ailbhe Tweedie", + "name" : "Ailbhe Tweedie", "data" : [ [ "Perl 5", 3 ] - ], - "id" : "Ailbhe Tweedie", - "name" : "Ailbhe Tweedie" + ] }, { "data" : [ @@ -525,49 +529,48 @@ 3 ] ], - "id" : "Alicia Bielsa", - "name" : "Alicia Bielsa" + "name" : "Alicia Bielsa", + "id" : "Alicia Bielsa" }, { - "id" : "Dave Cross", + "name" : "Dave Cross", "data" : [ [ - "Blog", - 1 - ], - [ "Perl 5", 2 + ], + [ + "Blog", + 1 ] ], - "name" : "Dave Cross" + "id" : "Dave Cross" }, { - "name" : "Dave Jacoby", - "id" : "Dave Jacoby", "data" : [ [ - "Perl 5", - 1 - ], - [ "Blog", 2 + ], + [ + "Perl 5", + 1 ] - ] + ], + "name" : "Dave Jacoby", + "id" : "Dave Jacoby" }, { - "name" : "Freddie B", "id" : "Freddie B", "data" : [ [ "Perl 5", 3 ] - ] + ], + "name" : "Freddie B" }, { - "name" : "Jeremy Carman", "data" : [ [ "Perl 6", @@ -578,91 +581,91 @@ 2 ] ], + "name" : "Jeremy Carman", "id" : "Jeremy Carman" }, { - "name" : "Kivanc Yazan", "id" : "Kivanc Yazan", "data" : [ [ "Perl 5", 3 ] - ] + ], + "name" : "Kivanc Yazan" }, { - "id" : "Neil Bowers", "data" : [ [ "Perl 5", 3 ] ], - "name" : "Neil Bowers" + "name" : "Neil Bowers", + "id" : "Neil Bowers" }, { "name" : "Pete Houston", - "id" : "Pete Houston", "data" : [ [ "Perl 5", 3 ] - ] + ], + "id" : "Pete Houston" }, { + "id" : "Sean Meininger", "data" : [ [ "Perl 6", 3 ] ], - "id" : "Sean Meininger", "name" : "Sean Meininger" } ] }, - "plotOptions" : { - "series" : { - "borderWidth" : 0, - "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - } - } + "title" : { + "text" : "Perl Weekly Challenge Leaders (TOP 50)" + }, + "subtitle" : { + "text" : "Click the columns to drilldown the score breakdown. Last updated at 2019-05-06 09:36:12 GMT" }, "series" : [ { + "colorByPoint" : "true", + "name" : "Perl Weekly Challenge Leaders", "data" : [ { "y" : 60, - "name" : "#1: Laurent Rosenfeld", - "drilldown" : "Laurent Rosenfeld" + "drilldown" : "Laurent Rosenfeld", + "name" : "#1: Laurent Rosenfeld" }, { "y" : 50, - "name" : "#2: Joelle Maslak", - "drilldown" : "Joelle Maslak" + "drilldown" : "Joelle Maslak", + "name" : "#2: Joelle Maslak" }, { + "y" : 48, "name" : "#3: Jaldhar H. Vyas", - "drilldown" : "Jaldhar H. Vyas", - "y" : 48 + "drilldown" : "Jaldhar H. Vyas" }, { - "y" : 40, "name" : "#4: Ruben Westerberg", - "drilldown" : "Ruben Westerberg" + "drilldown" : "Ruben Westerberg", + "y" : 40 }, { - "y" : 40, |
