# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #125985]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=125985 >


<masak_venue> hey, #perl6, I wrote this:
https://gist.github.com/masak/b84a87a694217c9508d6

constant nums = 1, 2, 3 ... Inf;
sub replace($divisor, $word) {
-> $n { $n %% $divisor ?? $word !! $n }
}
constant fizzbuzz = nums\
.map(replace(3, "Fizz"))\
.map(replace(5, "Buzz"))\
.map(replace(15, "FizzBuzz"));
say fizzbuzz[^100];

<masak_venue> I was sad to see I got a scary exception when running it :/
<masak_venue> I think "Cannot invoke this object" in this case is at
the very least unexpected, and probably reportable as a bug
<masak_venue> ok, it happens in the first .map
<masak_venue> I've golfed it down to something that requires newlines.
<masak_venue> m: constant nums = 1, 2, 3 ... Inf;␤constant fizzbuzz =
nums\␤    .map({ $_ %% 3 ?? "Fizz" !! $_ });
<camelia> rakudo-moar e6f360: OUTPUT«===SORRY!=== Error while
compiling /tmp/kAAlvWKBSo␤An exception occurred while evaluating a
constant␤at /tmp/kAAlvWKBSo:2␤Exception details:␤  ===SORRY!=== Error
while compiling ␤  Cannot invoke this object (REPR: Null, cs = 0)␤
at…»
<masak_venue> if I inline `nums`, the problem goes away
<masak_venue> if I remove the unspace, the problem goes away
* masak_venue submits rakudobug
<ShimmerFairy> m: constant nums = 1; constant fizzbuzz = nums\␤.map({ $_ });
<camelia> rakudo-moar e6f360: OUTPUT«===SORRY!=== Error while
compiling /tmp/VVtZHQ5EZS␤An exception occurred while evaluating a
constant␤at /tmp/VVtZHQ5EZS:1␤Exception details:␤  ===SORRY!=== Error
while compiling ␤  Cannot invoke this object (REPR: Null, cs = 0)␤
at…»
<ShimmerFairy> masak_venue: a bit shorter :)
<masak_venue> thank you

Reply via email to