aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2021-02-13 00:17:54 +0000
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2021-02-13 00:17:54 +0000
commitd069a7d374414fa41fa02a8b0ce296101cd2978f (patch)
tree9c31a66dc9f207153851ea9c389227aec63c177c
parentbf2016e22f929ec73e118b8cb0c179abc1c88f98 (diff)
downloadperlweeklychallenge-club-d069a7d374414fa41fa02a8b0ce296101cd2978f.tar.gz
perlweeklychallenge-club-d069a7d374414fa41fa02a8b0ce296101cd2978f.tar.bz2
perlweeklychallenge-club-d069a7d374414fa41fa02a8b0ce296101cd2978f.zip
- Added solutions by Laurent Rosenfeld.
-rw-r--r--challenge-099/laurent-rosenfeld/blog.txt1
-rw-r--r--challenge-099/laurent-rosenfeld/perl/ch-1.pl17
-rw-r--r--challenge-099/laurent-rosenfeld/perl/ch-2.pl23
-rw-r--r--challenge-099/laurent-rosenfeld/raku/ch-1.raku21
-rw-r--r--challenge-099/laurent-rosenfeld/raku/ch-2.raku12
-rw-r--r--stats/pwc-current.json189
-rw-r--r--stats/pwc-language-breakdown-summary.json70
-rw-r--r--stats/pwc-language-breakdown.json702
-rw-r--r--stats/pwc-leaders.json736
-rw-r--r--stats/pwc-summary-1-30.json122
-rw-r--r--stats/pwc-summary-121-150.json110
-rw-r--r--stats/pwc-summary-151-180.json94
-rw-r--r--stats/pwc-summary-181-210.json50
-rw-r--r--stats/pwc-summary-211-240.json58
-rw-r--r--stats/pwc-summary-31-60.json110
-rw-r--r--stats/pwc-summary-61-90.json40
-rw-r--r--stats/pwc-summary-91-120.json112
-rw-r--r--stats/pwc-summary.json490
18 files changed, 1527 insertions, 1430 deletions
diff --git a/challenge-099/laurent-rosenfeld/blog.txt b/challenge-099/laurent-rosenfeld/blog.txt
new file mode 100644
index 0000000000..061b21b81d
--- /dev/null
+++ b/challenge-099/laurent-rosenfeld/blog.txt
@@ -0,0 +1 @@
+http://blogs.perl.org/users/laurent_r/2021/02/perl-weekly-challenge-99-pattern-match-and-unique-subsequence.html
diff --git a/challenge-099/laurent-rosenfeld/perl/ch-1.pl b/challenge-099/laurent-rosenfeld/perl/ch-1.pl
new file mode 100644
index 0000000000..dbd4ff781b
--- /dev/null
+++ b/challenge-099/laurent-rosenfeld/perl/ch-1.pl
@@ -0,0 +1,17 @@
+use strict;
+use warnings;
+use feature "say";
+
+my $input = "abcde";
+my @test_patterns = qw/a*e a*d ?b*d a*c?e/;
+for my $pat (@test_patterns) {
+ say "$pat: ", match($input, $pat)
+}
+
+sub match {
+ my ($in, $pattern) = @_;
+ $pattern =~ s/\*/.*/g;
+ $pattern =~ s/\?/./g;
+ $pattern = "^$pattern\$";
+ return $in =~ /$pattern/ ? 1 : 0;
+}
diff --git a/challenge-099/laurent-rosenfeld/perl/ch-2.pl b/challenge-099/laurent-rosenfeld/perl/ch-2.pl
new file mode 100644
index 0000000000..3f446f1853
--- /dev/null
+++ b/challenge-099/laurent-rosenfeld/perl/ch-2.pl
@@ -0,0 +1,23 @@
+use strict;
+use warnings;
+use feature "say";
+
+my @input_tests = ( [ "littleit", "lit"], ["london", "lon"], ["aaaa", "aa"]);
+my $count;
+for my $in (@input_tests) {
+ $count = 0;
+ search_substr (@$in);
+ say "@$in: $count";
+}
+sub search_substr {
+ my ($in, $searched) = @_;
+ my $start = substr $searched, 0, 1;
+ my $index = 0;
+ while (1) {
+ $index = index $in, $start, $index;
+ return if $index < 0;
+ $index++;
+ ++$count and next if length $searched == 1;
+ search_substr (substr($in, $index), substr($searched, 1));
+ }
+}
diff --git a/challenge-099/laurent-rosenfeld/raku/ch-1.raku b/challenge-099/laurent-rosenfeld/raku/ch-1.raku
new file mode 100644
index 0000000000..881b11b7ab
--- /dev/null
+++ b/challenge-099/laurent-rosenfeld/raku/ch-1.raku
@@ -0,0 +1,21 @@
+use v6;
+
+my $in = "abcde";
+my @test-patterns = <a*e a*d ?b*d a*c?e>;
+for @test-patterns -> $test {
+ say "$test: ", match $test, $in;
+}
+
+sub match (Str $pattern, Str $in) {
+ my $regex =
+ join "", gather {
+ take '^';
+ for $pattern.comb {
+ when '*' { take '.*' }
+ when '?' { take '.' }
+ default { take $_ }
+ }
+ take '$';
+ }
+ return $in ~~ /<$regex>/ ?? 1 !! 0;
+}
diff --git a/challenge-099/laurent-rosenfeld/raku/ch-2.raku b/challenge-099/laurent-rosenfeld/raku/ch-2.raku
new file mode 100644
index 0000000000..a7b7ab274a
--- /dev/null
+++ b/challenge-099/laurent-rosenfeld/raku/ch-2.raku
@@ -0,0 +1,12 @@
+use v6;
+
+my @input-tests = [ "littleit", "lit"], ["london", "lon"];
+
+for @input-tests -> $test {
+ my ($in, $substr) = $test[0..1];
+ say "$test: ", search-substr $in, $substr;
+}
+sub search-substr (Str $in, Str $substr) {
+ my @results = $in.comb.combinations($substr.\
+ chars)>>.join("").grep({$_ eq $substr}).elems;
+}
diff --git a/stats/pwc-current.json b/stats/pwc-current.json
index c368438d63..b2b9a91f1e 100644
--- a/stats/pwc-current.json
+++ b/stats/pwc-current.json
@@ -2,70 +2,72 @@
"title" : {
"text" : "Perl Weekly Challenge - 099"
},
- "legend" : {
- "enabled" : 0
- },
"series" : [
{
"data" : [
{
- "name" : "Arne Sommer",
"y" : 5,
+ "name" : "Arne Sommer",
"drilldown" : "Arne Sommer"
},
{
- "drilldown" : "Dave Jacoby",
"y" : 3,
- "name" : "Dave Jacoby"
+ "name" : "Dave Jacoby",
+ "drilldown" : "Dave Jacoby"
},
{
+ "name" : "E. Choroba",
"drilldown" : "E. Choroba",
- "y" : 2,
- "name" : "E. Choroba"
+ "y" : 2
},
{
- "drilldown" : "Flavio Poletti",
+ "y" : 4,
"name" : "Flavio Poletti",
- "y" : 4
+ "drilldown" : "Flavio Poletti"
},
{
"name" : "Gustavo Chaves",
- "y" : 2,
- "drilldown" : "Gustavo Chaves"
+ "drilldown" : "Gustavo Chaves",
+ "y" : 2
},
{
- "drilldown" : "James Smith",
"y" : 3,
+ "drilldown" : "James Smith",
"name" : "James Smith"
},
{
- "drilldown" : "Jan Krnavek",
+ "y" : 2,
"name" : "Jan Krnavek",
- "y" : 2
+ "drilldown" : "Jan Krnavek"
},
{
- "drilldown" : "Luca Ferrari",
+ "drilldown" : "Laurent Rosenfeld",
+ "name" : "Laurent Rosenfeld",
+ "y" : 5
+ },
+ {
+ "y" : 4,
"name" : "Luca Ferrari",
- "y" : 4
+ "drilldown" : "Luca Ferrari"
},
{
- "name" : "Mark Anderson",
"y" : 2,
+ "name" : "Mark Anderson",
"drilldown" : "Mark Anderson"
},
{
+ "y" : 2,
"drilldown" : "Nuno Vieira",
- "name" : "Nuno Vieira",
- "y" : 2
+ "name" : "Nuno Vieira"
},
{
"name" : "Paulo Custodio",
- "y" : 2,
- "drilldown" : "Paulo Custodio"
+ "drilldown" : "Paulo Custodio",
+ "y" : 2
},
{
- "name" : "Pete Houston",
"y" : 2,
+ "name" : "Pete Houston",
"drilldown" : "Pete Houston"
},
{
@@ -79,13 +81,13 @@
"y" : 3
},
{
+ "y" : 2,
"drilldown" : "Simon Proctor",
- "name" : "Simon Proctor",
- "y" : 2
+ "name" : "Simon Proctor"
},
{
- "drilldown" : "Stuart Little",
"y" : 4,
+ "drilldown" : "Stuart Little",
"name" : "Stuart Little"
},
{
@@ -99,13 +101,45 @@
"drilldown" : "W. Luis Mochan"
}
],
- "colorByPoint" : 1,
- "name" : "Perl Weekly Challenge - 099"
+ "name" : "Perl Weekly Challenge - 099",
+ "colorByPoint" : 1
}
],
+ "plotOptions" : {
+ "series" : {
+ "borderWidth" : 0,
+ "dataLabels" : {
+ "enabled" : 1,
+ "format" : "{point.y}"
+ }
+ }
+ },
+ "chart" : {
+ "type" : "column"
+ },
+ "subtitle" : {
+ "text" : "[Champions: 19] Last updated at 2021-02-13 00:17:14 GMT"
+ },
+ "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
+ },
+ "yAxis" : {
+ "title" : {
+ "text" : "Total Solutions"
+ }
+ },
+ "xAxis" : {
+ "type" : "category"
+ },
+ "legend" : {
+ "enabled" : 0
+ },
"drilldown" : {
"series" : [
{
+ "id" : "Arne Sommer",
"name" : "Arne Sommer",
"data" : [
[
@@ -120,8 +154,7 @@
"Blog",
1
]
- ],
- "id" : "Arne Sommer"
+ ]
},
{
"data" : [
@@ -134,8 +167,8 @@
1
]
],
- "id" : "Dave Jacoby",
- "name" : "Dave Jacoby"
+ "name" : "Dave Jacoby",
+ "id" : "Dave Jacoby"
},
{
"id" : "E. Choroba",
@@ -148,6 +181,7 @@
"name" : "E. Choroba"
},
{
+ "name" : "Flavio Poletti",
"data" : [
[
"Perl",
@@ -158,21 +192,19 @@
2
]
],
- "id" : "Flavio Poletti",
- "name" : "Flavio Poletti"
+ "id" : "Flavio Poletti"
},
{
- "id" : "Gustavo Chaves",
"data" : [
[
"Perl",
2
]
],
- "name" : "Gustavo Chaves"
+ "name" : "Gustavo Chaves",
+ "id" : "Gustavo Chaves"
},
{
- "id" : "James Smith",
"data" : [
[
"Perl",
@@ -183,16 +215,35 @@
1
]
],
- "name" : "James Smith"
+ "name" : "James Smith",
+ "id" : "James Smith"
},
{
"name" : "Jan Krnavek",
- "id" : "Jan Krnavek",
"data" : [
[
"Raku",
2
]
+ ],
+ "id" : "Jan Krnavek"
+ },
+ {
+ "id" : "Laurent Rosenfeld",
+ "name" : "Laurent Rosenfeld",
+ "data" : [
+ [
+ "Perl",
+ 2
+ ],
+ [
+ "Raku",
+ 2
+ ],
+ [
+ "Blog",
+ 1
+ ]
]
},
{
@@ -210,8 +261,8 @@
"id" : "Luca Ferrari"
},
{
- "name" : "Mark Anderson",
"id" : "Mark Anderson",
+ "name" : "Mark Anderson",
"data" : [
[
"Raku",
@@ -220,36 +271,37 @@
]
},
{
+ "name" : "Nuno Vieira",
"data" : [
[
"Perl",
2
]
],
- "id" : "Nuno Vieira",
- "name" : "Nuno Vieira"
+ "id" : "Nuno Vieira"
},
{
- "name" : "Paulo Custodio",
+ "id" : "Paulo Custodio",
"data" : [
[
"Perl",
2
]
],
- "id" : "Paulo Custodio"
+ "name" : "Paulo Custodio"
},
{
+ "name" : "Pete Houston",
"data" : [
[
"Perl",
2
]
],
- "id" : "Pete Houston",
- "name" : "Pete Houston"
+ "id" : "Pete Houston"
},
{
+ "id" : "Roger Bell_West",
"data" : [
[
"Perl",
@@ -264,10 +316,10 @@
1
]
],
- "id" : "Roger Bell_West",
"name" : "Roger Bell_West"
},
{
+ "name" : "Simon Green",
"data" : [
[
"Perl",
@@ -278,20 +330,20 @@
1
]
],
- "id" : "Simon Green",
- "name" : "Simon Green"
+ "id" : "Simon Green"
},
{
- "id" : "Simon Proctor",
+ "name" : "Simon Proctor",
"data" : [
[
"Raku",
2
]
],
- "name" : "Simon Proctor"
+ "id" : "Simon Proctor"
},
{
+ "id" : "Stuart Little",
"data" : [
[
"Perl",
@@ -302,21 +354,19 @@
2
]
],
- "id" : "Stuart Little",
"name" : "Stuart Little"
},
{
- "name" : "Ulrich Rieke",
+ "id" : "Ulrich Rieke",
"data" : [
[
"Perl",
2
]
],
- "id" : "Ulrich Rieke"
+ "name" : "Ulrich Rieke"
},
{
- "name" : "W. Luis Mochan",
"data" : [
[
"Perl",
@@ -327,36 +377,9 @@
1
]
],
+ "name" : "W. Luis Mochan",
"id" : "W. Luis Mochan"
}
]
- },
- "subtitle" : {
- "text" : "[Champions: 18] Last updated at 2021-02-13 00:08:58 GMT"
- },
- "yAxis" : {
- "title" : {
- "text" : "Total Solutions"
- }
- },
- "chart" : {
- "type" : "column"
- },
- "xAxis" : {
- "type" : "category"
- },
- "plotOptions" : {
- "series" : {
- "borderWidth" : 0,
- "dataLabels" : {
- "enabled" : 1,
- "format" : "{point.y}"
- }
- }
- },
- "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
}
}
diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json
index 1bef88606c..8f2544ddb6 100644
--- a/stats/pwc-language-breakdown-summary.json
+++ b/stats/pwc-language-breakdown-summary.json
@@ -1,63 +1,63 @@
{
- "subtitle" : {
- "text" : "Last updated at 2021-02-13 00:08:58 GMT"
- },
- "legend" : {
- "enabled" : "false"
+ "yAxis" : {
+ "title" : {
+ "text" : null
+ },
+ "min" : 0
},
"series" : [
{
+ "dataLabels" : {
+ "rotation" : -90,
+ "color" : "#FFFFFF",
+ "format" : "{point.y:.0f}",
+ "align" : "right",
+ "style" : {
+ "fontFamily" : "Verdana, sans-serif",
+ "fontSize" : "13px"
+ },
+ "y" : 10,
+ "enabled" : "true"
+ },
+ "name" : "Contributions",
"data" : [
[
"Blog",
- 1326
+ 1327
],
[
"Perl",
- 4616
+ 4618
],
[
"Raku",
- 2982
+ 2984
]
- ],
- "dataLabels" : {
- "format" : "{point.y:.0f}",
- "color" : "#FFFFFF",
- "style" : {
- "fontSize" : "13px",
- "fontFamily" : "Verdana, sans-serif"
- },
- "rotation" : -90,
- "align" : "right",
- "y" : 10,
- "enabled" : "true"
- },
- "name" : "Contributions"
+ ]
}
],
- "title" : {
- "text" : "Perl Weekly Challenge Contributions [2019 - 2020]"
+ "subtitle" : {
+ "text" : "Last updated at 2021-02-13 00:17:14 GMT"
+ },
+ "chart" : {
+ "type" : "column"
},
"tooltip" : {
"pointFormat" : "<b>{point.y:.0f}</b>"
},
+ "title" : {
+ "text" : "Perl Weekly Challenge Contributions [2019 - 2020]"
+ },
+ "legend" : {
+ "enabled" : "false"
+ },
"xAxis" : {
"labels" : {
"style" : {
- "fontSize" : "13px",
- "fontFamily" : "Verdana, sans-serif"
+ "fontFamily" : "Verdana, sans-serif",
+ "fontSize" : "13px"
}
},
"type" : "category"
- },
- "chart" : {
- "type" : "column"
- },
- "yAxis" : {
- "title" : {
- "text" : null
- },
- "min" : 0
}
}
diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json
index ab16ec284f..d8e5e074a5 100644
--- a/stats/pwc-language-breakdown.json
+++ b/stats/pwc-language-breakdown.json
@@ -1,11 +1,13 @@
{
- "title" : {
- "text" : "Perl Weekly Challenge Language"
+ "xAxis" : {
+ "type" : "category"
+ },
+ "legend" : {
+ "enabled" : "false"
},
"drilldown" : {
"series" : [
{
- "id" : "001",
"data" : [
[
"Perl",
@@ -20,10 +22,10 @@
11
]
],
- "name" : "001"
+ "name" : "001",
+ "id" : "001"
},
{
- "id" : "002",
"data" : [
[
"Perl",
@@ -38,7 +40,8 @@
10
]
],
- "name" : "002"
+ "name" : "002",
+ "id" : "002"
},
{
"id" : "003",
@@ -59,7 +62,7 @@
"name" : "003"
},
{
- "id" : "004",
+ "name" : "004",
"data" : [
[
"Perl",
@@ -74,10 +77,11 @@
10
]
],
- "name" : "004"
+ "id" : "004"
},
{
"id" : "005",
+ "name" : "005",
"data" : [
[
"Perl",
@@ -91,10 +95,10 @@
"Blog",
12
]
- ],
- "name" : "005"
+ ]
},
{
+ "id" : "006",
"data" : [
[
"Perl",
@@ -109,11 +113,9 @@
7
]
],
- "id" : "006",
"name" : "006"
},
{
- "id" : "007",
"data" : [
[
"Perl",
@@ -128,11 +130,11 @@
10
]
],
- "name" : "007"
+ "name" : "007",
+ "id" : "007"
},
{
"name" : "008",
- "id" : "008",
"data" : [
[
"Perl",
@@ -146,10 +148,10 @@
"Blog",
12
]
- ]
+ ],
+ "id" : "008"
},
{
- "name" : "009",
"id" : "009",
"data" : [
[
@@ -164,10 +166,10 @@
"Blog",
13
]
- ]
+ ],
+ "name" : "009"
},
{
- "id" : "010",
"data" : [
[
"Perl",
@@ -182,9 +184,12 @@
11
]
],
- "name" : "010"
+ "name" : "010",
+ "id" : "010"
},
{
+ "id" : "011",
+ "name" : "011",
"data" : [
[
"Perl",
@@ -198,12 +203,10 @@
"Blog",
10
]
- ],
- "id" : "011",
- "name" : "011"
+ ]
},
{
- "id" : "012",
+ "name" : "012",
"data" : [
[
"Perl",
@@ -218,10 +221,9 @@
11
]
],
- "name" : "012"
+ "id" : "012"
},
{
- "name" : "013",
"id" : "013",
"data" : [
[
@@ -236,11 +238,11 @@
"Blog",
13
]
- ]
+ ],
+ "name" : "013"
},
{
"name" : "014",
- "id" : "014",
"data" : [
[
"Perl",
@@ -254,10 +256,12 @@
"Blog",
15
]
- ]
+ ],
+ "id" : "014"
},
{
"id" : "015",
+ "name" : "015",
"data" : [
[
"Perl",
@@ -271,11 +275,9 @@
"Blog",
15
]
- ],
- "name" : "015"
+ ]
},
{
- "id" : "016",
"data" : [
[
"Perl",
@@ -290,7 +292,8 @@
12
]
],
- "name" : "016"
+ "name" : "016",
+ "id" : "016"
},
{
"id" : "017",
@@ -311,7 +314,7 @@
"name" : "017"
},
{
- "name" : "018",
+ "id" : "018",
"data" : [
[
"Perl",
@@ -326,9 +329,10 @@
14
]
],
- "id" : "018"
+ "name" : "018"
},
{
+ "id" : "019",
"name" : "019",
"data" : [
[
@@ -343,10 +347,10 @@
"Blog",
13
]
- ],
- "id" : "019"
+ ]
},
{
+ "id" : "020",
"data" : [
[
"Perl",
@@ -361,7 +365,6 @@
13
]
],
- "id" : "020",
"name" : "020"
},
{
@@ -401,7 +404,6 @@
"name" : "022"
},
{
- "id" : "023",
"data" : [
[
"Perl",
@@ -416,10 +418,11 @@
12
]
],
- "name" : "023"
+ "name" : "023",
+ "id" : "023"
},
{
- "id" : "024",
+ "name" : "024",
"data" : [
[
"Perl",
@@ -434,11 +437,9 @@
11
]
],
- "name" : "024"
+ "id" : "024"
},
{
- "name" : "025",
- "id" : "025",
"data" : [
[
"Perl",
@@ -452,7 +453,9 @@
"Blog",
12
]
- ]
+ ],
+ "name" : "025",
+ "id" : "025"
},
{
"id" : "026",
@@ -473,7 +476,7 @@
"name" : "026"
},
{
- "name" : "027",
+ "id" : "027",
"data" : [
[
"Perl",
@@ -488,7 +491,7 @@
9
]
],
- "id" : "027"
+ "name" : "027"
},
{
"name" : "028",
@@ -509,7 +512,6 @@
"id" : "028"
},
{
- "name" : "029",
"id" : "029",
"data" : [
[
@@ -524,10 +526,12 @@
"Blog",
12
]
- ]
+ ],
+ "name" : "029"
},
{
"id" : "030",
+ "name" : "030",
"data" : [
[
"Perl",
@@ -541,12 +545,10 @@
"Blog",
10
]
- ],
- "name" : "030"
+ ]
},
{
"name" : "031",
- "id" : "031",
"data" : [
[
"Perl",
@@ -560,10 +562,11 @@
"Blog",
9
]
- ]
+ ],
+ "id" : "031"
},
{
- "id" : "032",
+ "name" : "032",
"data" : [
[
"Perl",
@@ -578,10 +581,9 @@
10
]
],
- "name" : "032"
+ "id" : "032"
},
{
- "name" : "033",
"id" : "033",
"data" : [
[
@@ -596,10 +598,10 @@
"Blog",
10
]
- ]
+ ],
+ "name" : "033"
},
{
- "name" : "034",
"id" : "034",
"data" : [
[
@@ -614,11 +616,10 @@
"Blog",
11
]
- ]
+ ],
+ "name" : "034"
},
{
- "name" : "035",
- "id" : "035",
"data" : [
[
"Perl",
@@ -632,10 +633,13 @@
"Blog",
9
]
- ]
+ ],
+ "name" : "035",
+ "id" : "035"
},
{
"id" : "036",
+ "name" : "036",
"data" : [
[
"Perl",
@@ -649,11 +653,11 @@
"Blog",
11
]
- ],
- "name" : "036"
+ ]
},
{
"id" : "037",
+ "name" : "037",
"data" : [
[
"Perl",
@@ -667,11 +671,10 @@
"Blog",
9
]
- ],
- "name" : "037"
+ ]
},
{
- "name" : "038",
+ "id" : "038",
"data" : [
[
"Perl",
@@ -686,10 +689,9 @@
12
]
],