diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2019-10-13 16:26:38 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2019-10-13 16:26:38 +0100 |
| commit | 9413aa77625e076bc96176b7ae8b932cb78d0d9e (patch) | |
| tree | a601de4c5748bd2ccad268edce40db465f59320e | |
| parent | cda71622b10a269ec99fa022fe23f1993378acb2 (diff) | |
| download | perlweeklychallenge-club-9413aa77625e076bc96176b7ae8b932cb78d0d9e.tar.gz perlweeklychallenge-club-9413aa77625e076bc96176b7ae8b932cb78d0d9e.tar.bz2 perlweeklychallenge-club-9413aa77625e076bc96176b7ae8b932cb78d0d9e.zip | |
- Added solutions by Laurent Rosenfeld.
| -rw-r--r-- | challenge-029/laurent-rosenfeld/blog.txt | 1 | ||||
| -rw-r--r-- | challenge-029/laurent-rosenfeld/perl5/ch-1.pl | 9 | ||||
| -rw-r--r-- | challenge-029/laurent-rosenfeld/perl6/ch-1.p6 | 8 | ||||
| -rw-r--r-- | challenge-029/laurent-rosenfeld/perl6/ch-2.p6 | 21 | ||||
| -rw-r--r-- | challenge-029/laurent-rosenfeld/perl6/fibonacci.c | 8 | ||||
| -rwxr-xr-x | challenge-029/laurent-rosenfeld/perl6/fibonacci.dll | bin | 0 -> 7867 bytes | |||
| -rw-r--r-- | challenge-029/laurent-rosenfeld/perl6/fibonacci.o | bin | 0 -> 1448 bytes | |||
| -rw-r--r-- | stats/pwc-current.json | 217 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 66 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 258 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 512 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 38 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 40 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 46 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 106 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 34 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 50 |
17 files changed, 742 insertions, 672 deletions
diff --git a/challenge-029/laurent-rosenfeld/blog.txt b/challenge-029/laurent-rosenfeld/blog.txt new file mode 100644 index 0000000000..a30d91efc6 --- /dev/null +++ b/challenge-029/laurent-rosenfeld/blog.txt @@ -0,0 +1 @@ +http://blogs.perl.org/users/laurent_r/2019/10/perl-weekly-challenge-29-brace-expansion-and-calling-c-code.html diff --git a/challenge-029/laurent-rosenfeld/perl5/ch-1.pl b/challenge-029/laurent-rosenfeld/perl5/ch-1.pl new file mode 100644 index 0000000000..43fc1d3f24 --- /dev/null +++ b/challenge-029/laurent-rosenfeld/perl5/ch-1.pl @@ -0,0 +1,9 @@ +#!/usr/bin/perl +use strict; +use warnings; +use feature qw/say/; + +my $in_str = shift // "Perl {Daily,Weekly,Monthly,Yearly} Challenge"; +my ($start, $options, $end) = $in_str =~ /([^{]+) \{ ([^}]+) \} (.+)/x; +s/^ +| +$//g for ($start, $options, $end); # removing leading or trailing spaces +say "$start $_ $end" for split / *, */, $options; diff --git a/challenge-029/laurent-rosenfeld/perl6/ch-1.p6 b/challenge-029/laurent-rosenfeld/perl6/ch-1.p6 new file mode 100644 index 0000000000..788626b648 --- /dev/null +++ b/challenge-029/laurent-rosenfeld/perl6/ch-1.p6 @@ -0,0 +1,8 @@ +use v6; + +sub MAIN (Str $input = 'Perl {Daily,Weekly,Monthly,Yearly} Challenge') { + my $match = $input ~~ /(<-[{]>+) '{' (<-[}]>+) '}' (.+)/; + my ($start, $options, $end) = map { ~$_ }, $match[0 .. 2]; + s:g/^ \h+ | \h+ $// for $start, $options, $end; + say "$start $_ $end" for $options.split(/\s*','\s*/); +} diff --git a/challenge-029/laurent-rosenfeld/perl6/ch-2.p6 b/challenge-029/laurent-rosenfeld/perl6/ch-2.p6 new file mode 100644 index 0000000000..c3b03df713 --- /dev/null +++ b/challenge-029/laurent-rosenfeld/perl6/ch-2.p6 @@ -0,0 +1,21 @@ +use v6; +use NativeCall; + +sub fib(int32) + returns int32 + is native('./fibonacci.dll') + { * } + +sub fib-p6 (Int $num) { + return 1 if $num == 0 or $num == 1; + return fib-p6($num - 1) + fib-p6($num - 2); +} + +sub MAIN (Int $num where * >= 0 = 36 ) { + my $start-time = INIT now; + say "C library function: ", fib($num); + say "Duration C function: ", now - $start-time; + my $now = now; + say "P6 subroutine: ", fib-p6 $num; + say "Duration P6 subroutine: ", now - $now; +} diff --git a/challenge-029/laurent-rosenfeld/perl6/fibonacci.c b/challenge-029/laurent-rosenfeld/perl6/fibonacci.c new file mode 100644 index 0000000000..15678d5066 --- /dev/null +++ b/challenge-029/laurent-rosenfeld/perl6/fibonacci.c @@ -0,0 +1,8 @@ +#include <stdio.h> +int fib (int a) { + if (a == 0 || a == 1) { + return 1; + } else { + return fib(a -1 ) + fib(a - 2); + } +} diff --git a/challenge-029/laurent-rosenfeld/perl6/fibonacci.dll b/challenge-029/laurent-rosenfeld/perl6/fibonacci.dll Binary files differnew file mode 100755 index 0000000000..730734947f --- /dev/null +++ b/challenge-029/laurent-rosenfeld/perl6/fibonacci.dll diff --git a/challenge-029/laurent-rosenfeld/perl6/fibonacci.o b/challenge-029/laurent-rosenfeld/perl6/fibonacci.o Binary files differnew file mode 100644 index 0000000000..913387d1ac --- /dev/null +++ b/challenge-029/laurent-rosenfeld/perl6/fibonacci.o diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 2c2e164948..57297d1613 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,17 +1,23 @@ { - "title" : { - "text" : "Perl Weekly Challenge - 029" - }, "subtitle" : { - "text" : "[Champions: 21] Last updated at 2019-10-13 15:15:07 GMT" + "text" : "[Champions: 22] Last updated at 2019-10-13 15:26:08 GMT" }, - "legend" : { - "enabled" : 0 + "chart" : { + "type" : "column" }, "tooltip" : { + "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>", "followPointer" : 1, - "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>", - "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/>" + }, + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + } + } }, "drilldown" : { "series" : [ @@ -26,6 +32,8 @@ "id" : "Andrezgz" }, { + "name" : "Arne Sommer", + "id" : "Arne Sommer", "data" : [ [ "Perl 6", @@ -35,42 +43,40 @@ "Blog", 1 ] - ], - "name" : "Arne Sommer", - "id" : "Arne Sommer" + ] }, { - "name" : "Burkhard Nickels", + "id" : "Burkhard Nickels", "data" : [ [ "Perl 5", 2 ] ], - "id" : "Burkhard Nickels" + "name" : "Burkhard Nickels" }, { - "name" : "Daniel Mita", "data" : [ [ "Perl 6", 2 ] ], - "id" : "Daniel Mita" + "id" : "Daniel Mita", + "name" : "Daniel Mita" }, { "id" : "Dave Cross", - "name" : "Dave Cross", "data" : [ [ "Perl 5", 2 ] - ] + ], + "name" : "Dave Cross" }, { - "name" : "Dave Jacoby", + "id" : "Dave Jacoby", "data" : [ [ "Perl 5", @@ -81,11 +87,11 @@ 1 ] ], - "id" : "Dave Jacoby" + "name" : "Dave Jacoby" }, { - "id" : "Duane Powell", "name" : "Duane Powell", + "id" : "Duane Powell", "data" : [ [ "Perl 5", @@ -114,18 +120,18 @@ 2 ] ], - "name" : "Joelle Maslak", - "id" : "Joelle Maslak" + "id" : "Joelle Maslak", + "name" : "Joelle Maslak" }, { "id" : "Kevin Colyer", - "name" : "Kevin Colyer", "data" : [ [ "Perl 6", 2 ] - ] + ], + "name" : "Kevin Colyer" }, { "data" : [ @@ -134,71 +140,90 @@ 2 ] ], - "name" : "Kivanc Yazan", - "id" : "Kivanc Yazan" + "id" : "Kivanc Yazan", + "name" : "Kivanc Yazan" }, { - "id" : "Lars Thegler", "data" : [ [ "Perl 5", 2 ] ], + "id" : "Lars Thegler", "name" : "Lars Thegler" }, { + "name" : "Laurent Rosenfeld", + "data" : [ + [ + "Perl 5", + 1 + ], + [ + "Perl 6", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Laurent Rosenfeld" + }, + { "id" : "Lubos Kolouch", - "name" : "Lubos Kolouch", "data" : [ [ "Perl 5", 2 ] - ] + ], + "name" : "Lubos Kolouch" }, { "id" : "Markus Holzer", - "name" : "Markus Holzer", "data" : [ [ "Perl 6", 2 ] - ] + ], + "name" : "Markus Holzer" }, { + "name" : "Noud", "id" : "Noud", "data" : [ [ "Perl 6", 2 ] - ], - "name" : "Noud" + ] }, { "name" : "Prajith P", + "id" : "Prajith P", "data" : [ [ "Perl 5", 1 ] - ], - "id" : "Prajith P" + ] }, { - "name" : "Rage311", + "id" : "Rage311", "data" : [ [ "Perl 5", 2 ] ], - "id" : "Rage311" + "name" : "Rage311" }, { "name" : "Roger Bell West", + "id" : "Roger Bell West", "data" : [ [ "Perl 5", @@ -212,21 +237,19 @@ "Blog", 1 ] - ], - "id" : "Roger Bell West" + ] }, { "name" : "Steven Wilson", + "id" : "Steven Wilson", "data" : [ [ "Perl 5", 1 ] - ], - "id" : "Steven Wilson" + ] }, { - "id" : "Ulrich Rieke", "data" : [ [ "Perl 5", @@ -237,9 +260,12 @@ 2 ] ], + "id" : "Ulrich Rieke", "name" : "Ulrich Rieke" }, { + "name" : "Yet Ebreo", + "id" : "Yet Ebreo", "data" : [ [ "Perl 5", @@ -253,39 +279,27 @@ "Blog", 2 ] - ], - "name" : "Yet Ebreo", - "id" : "Yet Ebreo" + ] } ] }, - "plotOptions" : { - "series" : { - "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - }, - "borderWidth" : 0 - } - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } + "title" : { + "text" : "Perl Weekly Challenge - 029" }, "series" : [ { "colorByPoint" : 1, + "name" : "Perl Weekly Challenge - 029", "data" : [ { - "name" : "Andrezgz", + "y" : 2, "drilldown" : "Andrezgz", - "y" : 2 + "name" : "Andrezgz" }, { - "name" : "Arne Sommer", "y" : 3, - "drilldown" : "Arne Sommer" + "drilldown" : "Arne Sommer", + "name" : "Arne Sommer" }, { "name" : "Burkhard Nickels", @@ -294,18 +308,18 @@ }, { "name" : "Daniel Mita", - "drilldown" : "Daniel Mita", - "y" : 2 + "y" : 2, + "drilldown" : "Daniel Mita" }, { - "name" : "Dave Cross", + "y" : 2, "drilldown" : "Dave Cross", - "y" : 2 + "name" : "Dave Cross" }, { - "name" : "Dave Jacoby", + "drilldown" : "Dave Jacoby", "y" : 3, - "drilldown" : "Dave Jacoby" + "name" : "Dave Jacoby" }, { "name" : "Duane Powell", @@ -313,34 +327,39 @@ "drilldown" : "Duane Powell" }, { - "name" : "E. Choroba", + "y" : 2, "drilldown" : "E. Choroba", - "y" : 2 + "name" : "E. Choroba" }, { - "y" : 4, "drilldown" : "Joelle Maslak", + "y" : 4, "name" : "Joelle Maslak" }, { + "name" : "Kevin Colyer", "drilldown" : "Kevin Colyer", - "y" : 2, - "name" : "Kevin Colyer" + "y" : 2 }, { + "name" : "Kivanc Yazan", "drilldown" : "Kivanc Yazan", - "y" : 2, - "name" : "Kivanc Yazan" + "y" : 2 }, { - "drilldown" : "Lars Thegler", + "name" : "Lars Thegler", "y" : 2, - "name" : "Lars Thegler" + "drilldown" : "Lars Thegler" + }, + { + "y" : 4, + "drilldown" : "Laurent Rosenfeld", + "name" : "Laurent Rosenfeld" }, { - "name" : "Lubos Kolouch", "y" : 2, - "drilldown" : "Lubos Kolouch" + "drilldown" : "Lubos Kolouch", + "name" : "Lubos Kolouch" }, { "name" : "Markus Holzer", @@ -348,48 +367,52 @@ "drilldown" : "Markus Holzer" }, { - "y" : 2, + "name" : "Noud", "drilldown" : "Noud", - "name" : "Noud" + "y" : 2 }, { - "name" : "Prajith P", + "drilldown" : "Prajith P", "y" : 1, - "drilldown" : "Prajith P" + "name" : "Prajith P" }, { + "name" : "Rage311", "drilldown" : "Rage311", - "y" : 2, - "name" : "Rage311" + "y" : 2 }, { - "y" : 4, + "name" : "Roger Bell West", "drilldown" : "Roger Bell West", - "name" : "Roger Bell West" + "y" : 4 }, { - "name" : "Steven Wilson", + "drilldown" : "Steven Wilson", "y" : 1, - "drilldown" : "Steven Wilson" + "name" : "Steven Wilson" }, { - "y" : 3, + "name" : "Ulrich Rieke", "drilldown" : "Ulrich Rieke", - "name" : "Ulrich Rieke" + "y" : 3 }, { + "name" : "Yet Ebreo", "y" : 6, - "drilldown" : "Yet Ebreo", - "name" : "Yet Ebreo" + "drilldown" : "Yet Ebreo" } - ], - "name" : "Perl Weekly Challenge - 029" + ] } ], "xAxis" : { "type" : "category" }, - "chart" : { - "type" : "column" + "legend" : { + "enabled" : 0 + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 79a5749a42..5a8baa147c 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,24 +1,15 @@ { "xAxis" : { + "type" : "category", "labels" : { "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" } - }, - "type" : "category" - }, - "yAxis" : { - "min" : 0, - "title" : { - "text" : null } }, - "legend" : { - "enabled" : "false" - }, "subtitle" : { - "text" : "Last updated at 2019-10-13 15:15:17 GMT" + "text" : "Last updated at 2019-10-13 15:26:32 GMT" }, "chart" : { "type" : "column" @@ -26,38 +17,47 @@ "title" : { "text" : "Perl Weekly Challenge Contributions - 2019" }, + "tooltip" : { + "pointFormat" : "<b>{point.y:.0f}</b>" + }, + "yAxis" : { + "title" : { + "text" : null + }, + "min" : 0 + }, + "legend" : { + "enabled" : "false" + }, "series" : [ { + "dataLabels" : { + "format" : "{point.y:.0f}", + "color" : "#FFFFFF", + "enabled" : "true", + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + }, + "y" : 10, + "align" : "right", + "rotation" : -90 + }, "data" : [ [ "Blog", - 308 + 309 ], [ "Perl 5", - 1166 + 1167 ], [ "Perl 6", - 705 + 707 ] ], - "name" : "Contributions", - "dataLabels" : { - "rotation" : -90, - "color" : "#FFFFFF", - "enabled" : "true", - "format" : "{point.y:.0f}", - "align" : "right", - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - }, - "y" : 10 - } + "name" : "Contributions" } - ], - "tooltip" : { - "pointFormat" : "<b>{point.y:.0f}</b>" - } + ] } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index f40bacaad8..7cd53ebe72 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,17 +1,13 @@ { "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2019-10-13 15:15:17 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2019-10-13 15:26:32 GMT" }, - "chart" : { - "type" : "column" - }, - "title" : { - "text" : "Perl Weekly Challenge Language" + "xAxis" : { + "type" : "category" }, "drilldown" : { "series" : [ { - "name" : "001", "id" : "001", "data" : [ [ @@ -26,7 +22,8 @@ "Blog", 11 ] - ] + ], + "name" : "001" }, { "name" : "002", @@ -47,7 +44,7 @@ "id" : "002" }, { - "name" : "003", + "id" : "003", "data" : [ [ "Perl 5", @@ -62,9 +59,10 @@ 8 ] ], - "id" : "003" + "name" : "003" }, { + "id" : "004", "name" : "004", "data" : [ [ @@ -79,11 +77,9 @@ "Blog", 9 ] - ], - "id" : "004" + ] }, { - "name" : "005", "data" : [ [ "Perl 5", @@ -98,6 +94,7 @@ 11 ] ], + "name" : "005", "id" : "005" }, { @@ -119,7 +116,6 @@ "name" : "006" }, { - "name" : "007", "data" : [ [ "Perl 5", @@ -134,11 +130,12 @@ 9 ] ], + "name" : "007", "id" : "007" }, { - "name" : "008", "id" : "008", + "name" : "008", "data" : [ [ "Perl 5", @@ -155,7 +152,7 @@ ] }, { - "id" : "009", + "name" : "009", "data" : [ [ "Perl 5", @@ -170,7 +167,7 @@ 13 ] ], - "name" : "009" + "id" : "009" }, { "id" : "010", @@ -191,8 +188,8 @@ "name" : "010" }, { - "name" : "011", "id" : "011", + "name" : "011", "data" : [ [ "Perl 5", @@ -209,7 +206,7 @@ ] }, { - "name" : "012", + "id" : "012", "data" : [ [ "Perl 5", @@ -224,11 +221,11 @@ 11 ] ], - "id" : "012" + "name" : "012" }, { - "name" : "013", "id" : "013", + "name" : "013", "data" : [ [ "Perl 5", @@ -245,8 +242,6 @@ ] }, { - "name" : "014", - "id" : "014", "data" : [ [ "Perl 5", @@ -260,11 +255,13 @@ "Blog", 14 ] - ] + ], + "name" : "014", + "id" : "014" }, { - "name" : "015", "id" : "015", + "name" : "015", "data" : [ [ "Perl 5", @@ -299,6 +296,7 @@ "id" : "016" }, { + "name" : "017", "data" : [ [ "Perl 5", @@ -313,11 +311,11 @@ 12 ] ], - "id" : "017", - "name" : "017" + "id" : "017" }, { "id" : "018", + "name" : "018", "data" : [ [ "Perl 5", @@ -331,12 +329,9 @@ "Blog", 14 ] - ], - "name" : "018" + ] }, { - "name" : "019", - "id" : "019", "data" : [ [ "Perl 5", @@ -350,7 +345,9 @@ "Blog", 13 ] - ] + ], + "name" : "019", + "id" : "019" }, { "name" : "020", @@ -371,7 +368,7 @@ "id" : "020" }, { - "id" : "021", + "name" : "021", "data" : [ [ "Perl 5", @@ -386,10 +383,9 @@ 10 ] ], - "name" : "021" + "id" : "021" }, { - "name" : "022", "id" : "022", "data" : [ [ @@ -404,7 +400,8 @@ "Blog", 10 ] - ] + ], + "name" : "022" }, { "data" : [ @@ -421,10 +418,11 @@ 12 ] ], - "id" : "023", - "name" : "023" + "name" : "023", + "id" : "023" }, { + "id" : "024", "name" : "024", "data" : [ [ @@ -439,10 +437,10 @@ "Blog", 11 ] - ], - "id" : "024" + ] }, { + "id" : "025", "name" : "025", "data" : [ [ @@ -457,12 +455,9 @@ "Blog", 12 ] - ], - "id" : "025" + ] }, { - "name" : "026", - "id" : "026", "data" : [ [ "Perl 5", @@ -476,10 +471,11 @@ "Blog", 10 ] - ] + ], + "name" : "026", + "id" : "026" }, { - "name" : "027", "id" : "027", "data" : [ [ @@ -494,10 +490,12 @@ "Blog", 8 ] - ] + ], + "name" : "027" }, { "id" : "028", + "name" : "028", "data" : [ [ "Perl 5", @@ -511,137 +509,158 @@ "Blog", 6 ] - ], - "name" : "028" + ] }, { "name" : "029", - "id" : "029", "data" : [ [ "Perl 5", - 29 + 30 ], [ "Perl 6", - 15 + 17 ], [ "Blog", - 5 + 6 ] - ] + ], + "id" : "029" } ] }, + "chart" : { + "type" : "column" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "legend" : { + "enabled" : "false" + }, "tooltip" : { "headerFormat" : "<span style=\"font-size:11px\"></span>", - "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>", - "followPointer" : "true" + "followPointer" : "true", + "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>" + }, + "title" : { + "text" : "Perl Weekly Challenge Language" + }, + "plotOptions" : { + "series" : { + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + }, + "borderWidth" : 0 + } }, "series" : [ { - "colorByPoint" : "true", "data" : [ { - "name" : "#001", + "drilldown" : "001", "y" : 132, - "drilldown" : "001" + "name" : "#001" }, { "drilldown" : "002", - "y" : 104, - "name" : "#002" + "name" : "#002", + "y" : 104 }, { "y" : 66, - "drilldown" : "003", - |
