# New Ticket Created by Timothy Bollman
# Please include the string: [perl #116186]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=116186 >
Rakudo Version: 2012.12-38-gc8de2eb
Story:
I was attempting to write a different solution to the Collatz Sequence problem
in this years Advent Calendar. I figured it was a sequence of numbers, the
sequence operation should be able to rock this problem efficiently. I'm not
sure if this is supposed to be supported by the implementation, but if it is, I
believe the problem comes down to Rakudo not liking to vivify later elements in
the sequence in order to vivify the current element.
Works:
my @collatz;
@collatz := Inf, 1, (2 .. *).map: -> $n {@collatz[$n - 1] + 1}
say @collatz[0 .. 5]
>Inf 1 2 3 4 5
Doesn't Work:
my @collatz;
@collatz := Inf, 1, (2 .. *).map -> $n { $n %% 2 ?? @collatz[$n div 2] !!
@colatz[3 * $n + 1] }
say @collatz[0 .. 5]
splice() not implemented in class 'Mu'
in method reify at src/gen/CORE.setting:5409
in method reify at src/gen/CORE.setting:5407
in method gimme at src/gen/CORE.setting:5797
in method exists at src/gen/CORE.setting:5786
in method at_pos at src/gen/CORE.setting:5766
in method postcircumfix:<[ ]> at src/gen/CORE.setting:1337
in method postcircumfix:<[ ]> at src/gen/CORE.setting:1384
in method postcircumfix:<[ ]> at src/gen/CORE.setting:5042
-Tim
irc: Tim-Tom