diff options
| -rw-r--r-- | challenge-026/mark-senn/perl6/ch-1.p6 | 82 | ||||
| -rw-r--r-- | challenge-026/mark-senn/perl6/ch-2.p6 | 41 | ||||
| -rw-r--r-- | stats/pwc-current.json | 183 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 68 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 404 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 884 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 52 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 40 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 44 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 98 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 268 |
11 files changed, 1151 insertions, 1013 deletions
diff --git a/challenge-026/mark-senn/perl6/ch-1.p6 b/challenge-026/mark-senn/perl6/ch-1.p6 new file mode 100644 index 0000000000..eb1dbb57b4 --- /dev/null +++ b/challenge-026/mark-senn/perl6/ch-1.p6 @@ -0,0 +1,82 @@ +# Perl Weekly Challenge - 026 +# Task #1 +# +# See +# engineering.purdue.edu/~mark/pwc -026 -1. pdf +# for more information. +# +# The command line should be, for example , +# perl6 t.p6 stones jewels +# The values for "stones" and "jewels" +# default to "chancellor" and "chocolate ". +# +# + +# Run using Perl v6.d; +use v6.d; + +sub MAIN($a = 'chancellor', $b = 'chocolate') +{ + # Check that$a and$b consist of only upper and lowerccase letters. + ($a ~~ /^^<[A..Za..z]>+$$/) or die qq/"$a" must consist of one or more letters /; + ($b ~~ /^^<[A..Za..z]>+$$/) or die qq/"$a" must consist of one or more letters /; + + # Convert$a and$b to arrays. + my @a =$a.comb (/./).unique; + my @b =$b.comb (/./); + + + # + # Array -based solution. + # + + # If keys to a hash can be expressed as small + # non -negative integers you may want to use an + # array instead of a hash. + my @in -a; + @a.map({@in -a[$_.ord] = True }); + $count = 0; + @b.map({@in -a[$_.ord] and $count++}); + $count.say; + + + # + # Cross -product based solution. + # + + $count = 0; + (@a X @b).map({$_[0] eq $_[1] and $count++}); + $count.say; + + + # + # Hash -based solution. + # + + # Make a %a hash with letter keys and True values. + # The letters in %a are the ones we count in$b. + my %a = @a.map({$_ => True }); + + # Count the characters in$b that occur in$a. + my $count = 0; + @b.map ({%a{$_} and $count++}); + + $count.say; + + + # + # Set -based solution. + # + + # When I was looking up "perl6 degrees to radians" to see if there was + # a built -in Perl 6 method to do it I came across + # http :// blogs.perl.org/users/laurent_r /2019/09/ + # perl -weekly -challenge -26-common -letters -and -mean -angles.html + # showing how to convert a list/array to a set. + # I like Laurent Rosenfeld's solution better than any I did above. + # The following is based on his work. + my $aset = @a.Set; + $count = @b.grep({$_ (elem) $aset }).elems; + $count.say; +} + diff --git a/challenge-026/mark-senn/perl6/ch-2.p6 b/challenge-026/mark-senn/perl6/ch-2.p6 new file mode 100644 index 0000000000..823df39a4f --- /dev/null +++ b/challenge-026/mark-senn/perl6/ch-2.p6 @@ -0,0 +1,41 @@ +# +# Perl Weekly Challenge - 026 +# Task #2 +# +# See +# engineering.purdue.edu/~mark/pwc -026 -2. pdf +# for more information. +# +# The command line should be, for example , +# perl6 t.p6 1 2 3 +# to get the mean angle of 1, 2, and 3 degrees. +# + +# Run using Perl v6.d; +use v6.d; + +sub MAIN(*@deg where @deg.elems > 0) +{ + # Convert from degrees to radians. + my @rad = @deg <<*>> (pi /180); + + # Transform from degrees to polar coordinates. + my Complex @z = @rad.map({e**(i *$_)}); + + # Compute$p -bar in polar coordinates. + my$p -bar = ([+] @z) / @z.elems; + + # Compute arctangent and convert from radians to degrees. + # Sample inputs and outputs: + # INPUT OUTPUT COMMENT + # ---------- ----------------------- ------- + # 1 1 1 + # 1 2 1.5 + # 1 2 3 2 + # 10 -10 0 + # 10 20 30 19.999999999999996 wrong + # 60 59.99999999999999 wrong + # 350 10 -1.614809932057922e-15 wrong + my$theta -bar = atan2($p -bar.im ,$p -bar.re) * (180/pi); + $theta -bar.say; +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 63f576a51e..78e0f6d774 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,19 +1,14 @@ { - "xAxis" : { - "type" : "category" - }, "subtitle" : { - "text" : "[Champions: 20] Last updated at 2019-09-22 23:35:33 GMT" + "text" : "[Champions: 21] Last updated at 2019-09-23 00:23:18 GMT" }, "series" : [ { - "colorByPoint" : 1, - "name" : "Perl Weekly Challenge - 026", "data" : [ { "y" : 3, - "name" : "Adam Russell", - "drilldown" : "Adam Russell" + "drilldown" : "Adam Russell", + "name" : "Adam Russell" }, { "drilldown" : "Andrezgz", @@ -31,19 +26,19 @@ "drilldown" : "Athanasius" }, { + "y" : 2, "name" : "Daniel Mantovani", - "drilldown" : "Daniel Mantovani", - "y" : 2 + "drilldown" : "Daniel Mantovani" }, { - "y" : 2, + "drilldown" : "Donald Hunter", "name" : "Donald Hunter", - "drilldown" : "Donald Hunter" + "y" : 2 }, { "y" : 2, - "drilldown" : "Duane Powell", - "name" : "Duane Powell" + "name" : "Duane Powell", + "drilldown" : "Duane Powell" }, { "y" : 3, @@ -51,34 +46,39 @@ "drilldown" : "E. Choroba" }, { - "drilldown" : "Jaldhar H. Vyas", "name" : "Jaldhar H. Vyas", + "drilldown" : "Jaldhar H. Vyas", "y" : 5 }, { - "y" : 4, "name" : "Joelle Maslak", - "drilldown" : "Joelle Maslak" + "drilldown" : "Joelle Maslak", + "y" : 4 }, { + "y" : 5, "drilldown" : "Laurent Rosenfeld", - "name" : "Laurent Rosenfeld", - "y" : 5 + "name" : "Laurent Rosenfeld" }, { - "y" : 2, "name" : "Lubos Kolouch", - "drilldown" : "Lubos Kolouch" + "drilldown" : "Lubos Kolouch", + "y" : 2 }, { - "name" : "Markus Holzer", + "y" : 2, + "drilldown" : "Mark Senn", + "name" : "Mark Senn" + }, + { + "y" : 2, "drilldown" : "Markus Holzer", - "y" : 2 + "name" : "Markus Holzer" }, { + "y" : 2, "drilldown" : "Noud", - "name" : "Noud", - "y" : 2 + "name" : "Noud" }, { "y" : 2, @@ -91,31 +91,30 @@ "y" : 5 }, { - "name" : "Ruben Westerberg", "drilldown" : "Ruben Westerberg", + "name" : "Ruben Westerberg", "y" : 4 }, { + "y" : 2, "drilldown" : "Simon Proctor", - "name" : "Simon Proctor", - "y" : 2 + "name" : "Simon Proctor" }, { - "drilldown" : "Steven Wilson", "name" : "Steven Wilson", + "drilldown" : "Steven Wilson", "y" : 2 }, { + "y" : 4, "drilldown" : "Yet Ebreo", - "name" : "Yet Ebreo", - "y" : 4 + "name" : "Yet Ebreo" } - ] + ], + "name" : "Perl Weekly Challenge - 026", + "colorByPoint" : 1 } ], - "legend" : { - "enabled" : 0 - }, "yAxis" : { "title" : { "text" : "Total Solutions" @@ -125,7 +124,6 @@ "series" : [ { "id" : "Adam Russell", - "name" : "Adam Russell", "data" : [ [ "Perl 5", @@ -135,21 +133,21 @@ "Blog", 1 ] - ] + ], + "name" : "Adam Russell" }, { "id" : "Andrezgz", - "name" : "Andrezgz", "data" : [ [ "Perl 5", 2 ] - ] + ], + "name" : "Andrezgz" }, { "id" : "Arne Sommer", - "name" : "Arne Sommer", "data" : [ [ "Perl 6", @@ -159,9 +157,11 @@ "Blog", 1 ] - ] + ], + "name" : "Arne Sommer" }, { + "name" : "Athanasius", "data" : [ [ "Perl 5", @@ -172,18 +172,17 @@ 2 ] ], - "id" : "Athanasius", - "name" : "Athanasius" + "id" : "Athanasius" }, { - "name" : "Daniel Mantovani", - "id" : "Daniel Mantovani", "data" : [ [ "Perl 5", 2 ] - ] + ], + "name" : "Daniel Mantovani", + "id" : "Daniel Mantovani" }, { "data" : [ @@ -196,20 +195,22 @@ 1 ] ], - "id" : "Donald Hunter", - "name" : "Donald Hunter" + "name" : "Donald Hunter", + "id" : "Donald Hunter" }, { + "id" : "Duane Powell", "data" : [ [ "Perl 5", 2 ] ], - "id" : "Duane Powell", "name" : "Duane Powell" }, { + "id" : "E. Choroba", + "name" : "E. Choroba", "data" : [ [ "Perl 5", @@ -219,11 +220,10 @@ "Blog", 1 ] - ], - "name" : "E. Choroba", - "id" : "E. Choroba" + ] }, { + "id" : "Jaldhar H. Vyas", "data" : [ [ "Perl 5", @@ -238,10 +238,11 @@ 1 ] ], - "id" : "Jaldhar H. Vyas", "name" : "Jaldhar H. Vyas" }, { + "id" : "Joelle Maslak", + "name" : "Joelle Maslak", "data" : [ [ "Perl 5", @@ -251,13 +252,11 @@ "Perl 6", 2 ] - ], - "name" : "Joelle Maslak", - "id" : "Joelle Maslak" + ] }, { - "name" : "Laurent Rosenfeld", "id" : "Laurent Rosenfeld", + "name" : "Laurent Rosenfeld", "data" : [ [ "Perl 5", @@ -274,24 +273,34 @@ ] }, { + "id" : "Lubos Kolouch", + "name" : "Lubos Kolouch", "data" : [ [ "Perl 5", 2 ] + ] + }, + { + "id" : "Mark Senn", + "data" : [ + [ + "Perl 6", + 2 + ] ], - "name" : "Lubos Kolouch", - "id" : "Lubos Kolouch" + "name" : "Mark Senn" }, { "name" : "Markus Holzer", - "id" : "Markus Holzer", "data" : [ [ "Perl 6", 2 ] - ] + ], + "id" : "Markus Holzer" }, { "id" : "Noud", @@ -304,18 +313,17 @@ ] }, { - "id" : "Ozzy", "name" : "Ozzy", "data" : [ [ "Perl 6", 2 ] - ] + ], + "id" : "Ozzy" }, { "name" : "Roger Bell West", - "id" : "Roger Bell West", "data" : [ [ "Perl 5", @@ -329,10 +337,10 @@ "Blog", 1 ] - ] + ], + "id" : "Roger Bell West" }, { - "name" : "Ruben Westerberg", "id" : "Ruben Westerberg", "data" : [ [ @@ -343,29 +351,32 @@ "Perl 6", 2 ] - ] + ], + "name" : "Ruben Westerberg" }, { - "name" : "Simon Proctor", "id" : "Simon Proctor", "data" : [ [ "Perl 6", 2 ] - ] + ], + "name" : "Simon Proctor" }, { - "id" : "Steven Wilson", - "name" : "Steven Wilson", "data" : [ [ "Perl 5", 2 ] - ] + ], + "name" : "Steven Wilson", + "id" : "Steven Wilson" }, { + "id" : "Yet Ebreo", + "name" : "Yet Ebreo", "data" : [ [ "Perl 5", @@ -375,30 +386,34 @@ "Perl 6", 2 ] - ], - "id" : "Yet Ebreo", - "name" : "Yet Ebreo" + ] } ] }, "title" : { "text" : "Perl Weekly Challenge - 026" }, + "xAxis" : { + "type" : "category" + }, + "tooltip" : { + "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/>", + "followPointer" : 1 + }, + "chart" : { + "type" : "column" + }, "plotOptions" : { "series" : { "borderWidth" : 0, "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 + "enabled" : 1, + "format" : "{point.y}" } } }, - "tooltip" : { - "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/>" - }, - "chart" : { - "type" : "column" + "legend" : { + "enabled" : 0 } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index a33a619fe2..3fb756d1de 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,9 +1,6 @@ { - "title" : { - "text" : "Perl Weekly Challenge Contributions - 2019" - }, - "legend" : { - "enabled" : "false" + "tooltip" : { + "pointFormat" : "<b>{point.y:.0f}</b>" }, "yAxis" : { "title" : { @@ -11,21 +8,27 @@ }, "min" : 0 }, + "subtitle" : { + "text" : "Last updated at 2019-09-23 00:23:25 GMT" + }, + "title" : { + "text" : "Perl Weekly Challenge Contributions - 2019" + }, + "xAxis" : { + "type" : "category", + "labels" : { + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + } + } + }, + "legend" : { + "enabled" : "false" + }, "series" : [ { "name" : "Contributions", - "dataLabels" : { - "rotation" : -90, - "enabled" : "true", - "y" : 10, - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - }, - "format" : "{point.y:.0f}", - "color" : "#FFFFFF", - "align" : "right" - }, "data" : [ [ "Blog", @@ -37,26 +40,23 @@ ], [ "Perl 6", - 648 + 650 ] - ] - } - ], - "tooltip" : { - "pointFormat" : "<b>{point.y:.0f}</b>" - }, - "xAxis" : { - "type" : "category", - "labels" : { - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" + ], + "dataLabels" : { + "enabled" : "true", + "rotation" : -90, + "y" : 10, + "format" : "{point.y:.0f}", + "align" : "right", + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + }, + "color" : "#FFFFFF" } } - }, - "subtitle" : { - "text" : "Last updated at 2019-09-22 23:35:44 GMT" - }, + ], "chart" : { "type" : "column" } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 38ce130378..aa20fe011e 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,17 +1,167 @@ { - "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2019-09-22 23:35:44 GMT" + "xAxis" : { + "type" : "category" + }, + "title" : { + "text" : "Perl Weekly Challenge Language" }, + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + } + } + }, + "legend" : { + "enabled" : "false" + }, + "series" : [ + { + "colorByPoint" : "true", + "name" : "Perl Weekly Challenge Languages", + "data" : [ + { + "drilldown" : "001", + "name" : "#001", + "y" : 132 + }, + { + "y" : 104, + "name" : "#002", + "drilldown" : "002" + }, + { + "name" : "#003", + "y" : 66, + "drilldown" : "003" + }, + { + "y" : 86, + "name" : "#004", + "drilldown" : "004" + }, + { + "drilldown" : "005", + "name" : "#005", + "y" : 66 + }, + { + "y" : 47, + "name" : "#006", + "drilldown" : "006" + }, + { + "drilldown" : "007", + "y" : 55, + "name" : "#007" + }, + { + "y" : 69, + "name" : "#008", + "drilldown" : "008" + }, + { + "name" : "#009", + "y" : 68, + "drilldown" : "009" + }, + { + "y" : 60, + "name" : "#010", + "drilldown" : "010" + }, + { + "y" : 78, + "name" : "#011", + "drilldown" : "011" + }, + { + "drilldown" : "012", + "name" : "#012", + "y" : 83 + }, + { + "drilldown" : "013", + "y" : 76, + "name" : "#013" + }, + { + "name" : "#014", + "y" : 95, + "drilldown" : "014" + }, + { + "drilldown" : "015", + "y" : 93, + "name" : "#015" + }, + { + "drilldown" : "016", + "name" : "#016", + "y" : 66 + }, + { + "drilldown" : "017", + "name" : "#017", + "y" : 79 + }, + { + "y" : 76, + "name" : "#018", + "drilldown" : "018" + }, + { + "name" : "#019", + "y" : 95, + "drilldown" : "019" + }, + { + "name" : "#020", + "y" : 95, + "drilldown" : "020" + }, + { + "drilldown" : "021", + "name" : "#021", + "y" : 67 + }, + { + "name" : "#022", + "y" : 63, + "drilldown" : "022" + }, + { + "drilldown" : "023", + "name" : "#023", + "y" : 91 + }, + { + "drilldown" : "024", + "name" : "#024", + "y" : 68 + }, + { + "drilldown" : "025", + "name" : "#025", + "y" : 53 + }, + { + "drilldown" : "026", + "name" : "#026", + "y" : 63 + } + ] + } + ], "chart" : { "type" : "column" }, - "xAxis" : { - "type" : "category" - }, "drilldown" : { "series" : [ { - "name" : "001", + "id" : "001", "data" : [ [ "Perl 5", @@ -26,10 +176,10 @@ 11 ] ], - "id" : "001" + "name" : "001" }, { - "name" : "002", + "id" : "002", "data" : [ [ "Perl 5", @@ -44,9 +194,10 @@ 9 ] ], - "id" : "002" + "name" : "002" }, { + "id" : "003", "data" : [ [ "Perl 5", @@ -61,10 +212,10 @@ 8 ] ], - "name" : "003", - "id" : "003" + "name" : "003" }, { + "id" : "004", "data" : [ [ "Perl 5", @@ -79,10 +230,11 @@ 9 ] ], - "name" : "004", - "id" : "004" + "name" : "004" }, { + "name" : "005", + "id" : "005", "data" : [ [ "Perl 5", @@ -96,11 +248,10 @@ "Blog", 11 ] - ], - "name" : "005", - "id" : "005" + ] }, { + "name" : "006", "data" : [ [ "Perl 5", @@ -115,10 +266,10 @@ 6 ] ], - "name" : "006", "id" : "006" }, { + "id" : "007", "data" : [ [ "Perl 5", @@ -133,8 +284,7 @@ 9 ] ], - "name" : "007", - "id" : "007" + "name" : "007" }, { "data" : [ @@ -151,10 +301,12 @@ 11 ] ], - "name" : "008", - "id" : "008" + "id" : "008", + "name" : "008" }, { + "name" : "009", + "id" : "009", "data" : [ [ "Perl 5", @@ -168,9 +320,7 @@ "Blog", 13 ] - ], - "name" : "009", - "id" : "009" + ] }, { "data" : [ @@ -187,8 +337,8 @@ 11 ] ], - "name" : "010", - "id" : "010" + "id" : "010", + "name" : "010" }, { "name" : "011", @@ -210,7 +360,6 @@ }, { "id" : "012", - "name" : "012", "data" : [ [ "Perl 5", @@ -224,10 +373,10 @@ "Blog", 11 ] - ] + ], + "name" : "012" }, { - "id" : "013", "data" : [ [ "Perl 5", @@ -242,11 +391,11 @@ 13 ] ], + "id" : "013", "name" : "013" }, { "id" : "014", - "name" : "014", "data" : [ [ "Perl 5", @@ -260,11 +409,10 @@ "Blog", 14 ] - ] + ], + "name" : "014" }, { - "id" : "015", - "name" : "015", "data" : [ [ "Perl 5", @@ -278,11 +426,12 @@ "Blog", 15 ] - ] + ], + "id" : "015", + "name" : "015" }, { "id" : "016", - "name" : "016", "data" : [ [ "Perl 5", @@ -296,9 +445,11 @@ "Blog", 12 ] - ] + ], + "name" : "016" }, { + "name" : "017", "id" : "017", "data" : [ [ @@ -313,8 +464,7 @@ "Blog", 12 ] - ], - "name" : "017" + ] }, { "name" : "018", @@ -335,7 +485,6 @@ "id" : "018" }, { - "id" : "019", "data" : [ [ "Perl 5", @@ -350,9 +499,11 @@ 13 ] ], + "id" : "019", "name" : "019" }, { + "name" : "020", "data" : [ [ "Perl 5", @@ -367,11 +518,11 @@ 13 ] ], - "name" : "020", "id" : "020" }, { "name" : "021", + "id" : "021", "data" : [ [ "Perl 5", @@ -385,12 +536,11 @@ "Blog", 10 ] - ], - "id" : "021" + ] }, { - "id" : "022", "name" : "022", + "id" : "022", "data" : [ [ "Perl 5", @@ -407,8 +557,8 @@ ] }, { - "id" : "023", "name" : "023", + "id" : "023", "data" : [ [ "Perl 5", @@ -425,6 +575,7 @@ ] }, { + "name" : "024", "data" : [ [ "Perl 5", @@ -439,12 +590,10 @@ 11 ] ], - "name" : "024", "id" : "024" }, { "id" : "025", - "name" : "025", "data" : [ [ "Perl 5", @@ -458,7 +607,8 @@ "Blog", 11 ] - ] + ], + "name" : "025" }, { "id" : "026", @@ -469,7 +619,7 @@ ], [ "Perl 6", - 25 + 27 ], [ "Blog", @@ -481,166 +631,16 @@ ] }, "tooltip" : { - "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>", "headerFormat" : "<span style=\"font-size:11px\"></span>", - "followPointer" : "true" - }, - "series" : [ - { - "data" : [ - { - "drilldown" : "001", - "name" : "#001", - "y" : 132 - }, - { - "y" : 104, - "name" : "#002", - "drilldown" : "002" |
