# New Ticket Created by (Mark A. Hershberger) # Please include the string: [perl #61904] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61904 >
Again, playing around with Euler, wrote myself a simple little class to generate primes. Pugs gives the correct result, printing out the first 10 primes. Rakudo prints ‘2' and then sits spinning. #!perl6 class Prime { has @!primes is rw; has Int $!number is rw = 1; method next() { my $not_prime = 1; while($not_prime && $!number++) { $not_prime = @!primes.grep({$!number % $^a == 0}); } @!primes.push($!number); my $copy = $!number; return $copy; } } my $p = Prime.new; say $p.next for (1..10);