This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Zoek een 9-letterige string van die enkel volgende letters mag bevatten: "acdegilmnoprstuw" zodat de hash(de_string) hetvolgende is "910897038977002". | |
* if hash is defined by the following pseudo-code: | |
* Int64 hash (String s) { Int64 h = 7 String letters = "acdegilmnoprstuw" for(Int32 i = 0; i < s.length; i++) { h = (h * 37 + letters.indexOf(s[i])) } return h } | |
* For example, if we were trying to find the 7 letter string where hash(the_string) was 680131659347, the answer would be "leepadg".) | |
*/ | |
void Main() | |
{ | |
new [] | |
{ | |
680131659347, // leepadg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NQP (master) | |
real 3m18.296s | |
user 2m52.579s | |
sys 0m6.636s | |
real 3m4.194s | |
user 2m51.095s | |
sys 0m6.856s | |
RAKUDO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my grammar G { | |
method s_m(*%n) { say(%n<a b c>) } | |
token TOP { <s_m(|{:a<1>, :c<3>}, :b<2>)> } | |
} | |
G.s_m(|{:a<1>, :c<3>}, :b<2>); | |
G.parse(''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t/qregex/01-qregex.t .. Failed 3/706 subtests | |
Test Summary Report | |
------------------- | |
t/qregex/01-qregex.t (Wstat: 0 Tests: 706 Failed: 3) | |
Failed tests: 18-19, 290 | |
Files=1, Tests=706, 18 wallclock secs ( 0.26 usr 0.01 sys + 17.02 cusr 0.40 csys = 17.69 CPU) | |
Result: FAIL | |
not ok 18 - alt subpattern in group |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/Match.pm b/src/core/Match.pm | |
index ffb0ae3..eb7a800 100644 | |
--- a/src/core/Match.pm | |
+++ b/src/core/Match.pm | |
@@ -7,6 +7,9 @@ my class Match is Capture { | |
multi method Str(Match:D:) { | |
$!to > $!from ?? $!orig.substr($!from, $!to-$!from) !! ''; | |
} | |
+ method Numeric(Match:D:) { | |
+ self.Str.Numeric; |