masak (>):
> <masak> rakudo: my @a = 1..10; say ~(@a>>.trans((1..26) => (14..26,1..13)))
> <p6eval> rakudo a37640: OUTPUT«No candidates found to invoke for
> method 'increment_index' on object of type 'LSM'; available candidates
> have signatures:␤:(Mu : Regex $s;; *%_)␤:(Mu : Str $s;; *%_)␤␤  in
> 'Cool::next_substitution' at line 2466:CORE.setting␤  in 'Cool::trans'
> at line 2512:CORE.setting␤  in main pro…
> * masak submits rakudobug
> <masak> that one's my fault. sorry 'bout that.
> <masak> signature should probably be Cool, not Str.
>
> For once, the whole error message is shock-full of pertinent details.
> Thanks to it, I know exactly what the problem is, where it is, and how
> to fix it.

Hm, the obvious fix is the following:

diff --git a/src/core/Cool-str.pm b/src/core/Cool-str.pm
index b35b779..ea3601a 100644
--- a/src/core/Cool-str.pm
+++ b/src/core/Cool-str.pm
@@ -212,7 +212,7 @@ augment class Cool {
             $!index = $!next_match + $/.chars;
         }

-        multi submethod increment_index(Str $s) {
+        multi submethod increment_index(Cool $s) {
             $!index = $!next_match + $s.chars;
         }

With it applied, I get the following (only partly satisfactory) output:


$ ./perl6 -e 'my @a = 1..10; say "!$_!" for (@a>>.trans((1..26) =>
(14..26,1..13)))'
!14!
!!
!!
!!
!!
!!
!!
!!
!!
!!

That is, the first transliteration call works as expected, but the
subsequent 9 don't. Maybe there's some state within the LTM engine
that isn't reset properly?

Will investigate more later.

// Carl

Reply via email to