From 9e54ebdd2a61865c1f48b1279995e6964ab8daa2 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Tue, 23 Oct 2018 07:55:02 +0200 Subject: Use full adverb in count-substring --- .../2018-10-11-hackerrank-solutions-python3-and-perl6-part-2.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to '_posts') diff --git a/_posts/2018-10-11-hackerrank-solutions-python3-and-perl6-part-2.html b/_posts/2018-10-11-hackerrank-solutions-python3-and-perl6-part-2.html index 92f4dc0..6bad7cb 100644 --- a/_posts/2018-10-11-hackerrank-solutions-python3-and-perl6-part-2.html +++ b/_posts/2018-10-11-hackerrank-solutions-python3-and-perl6-part-2.html @@ -257,7 +257,8 @@ read, in my opinion.
-{% highlight perl6 tio=https://tio.run/##K0gtyjH7/7@4NEkhOb80r0QXyCouKcrMS1fQUIEwdBRUgIK6EI6mQjUXZ2pOam6xAlRaoa5OIdcqv0wfSZU@V@1/NOM0VLQ8/fTSU0uAxkFZmnrFiZX/HZ2cXYCQC4gB %} +{% highlight perl6 +tio=https://tio.run/##K0gtyjH7/7@4NEkhOb80r0QXyCouKcrMS1fQUIEwdBRUgIK6EI6mQjUXZ2pOam6xAlRaoa5OIdcqvwxoUGKBPpJSfa7a/2hmaqhoefrppaeWAM2EsjT1ihMr/zs6ObsAIRcQAwA %} sub count-substring ($string, $sub-string) { elems $string ~~ m:overlap/$sub-string/ } @@ -269,8 +270,8 @@ sub count-substring ($string, $sub-string) { {% markdown %} The Perl 6 version makes use of some regex magic, and the `elems` subroutine. `elems` returns the number of elements in a list, which in this case would be -the number of matches found by the regex. The `m:ov//` makes a regex to -*m*atch, with *ov*erlapping strings. +the number of matches found by the regex. The `m:overlap//` makes a regex to +*m*atch, with *overlap*ping strings. {% endmarkdown %}
-- cgit v1.1