Re: Gather, take, newbie questions

2013-12-11 Thread Richard Hainsworth
Hello Jacinta, Perl6 code should be much simpler than what you are trying. There is no need to use a state variable or a binding. I'm not sure how to use a maximum in the sequence, so I didn't. The Fibonacci sequence can be generated in a single line as 1, 1, &[+] ... * or as 1, 1, *+* ...

Re: Gather, take, newbie questions

2013-12-11 Thread Larry Wall
On Thu, Dec 12, 2013 at 02:05:35PM +1100, Jacinta Richardson wrote: :sub MAIN($terms = 35, $maximum = 4_000_000) { : my @sequence = gather for fibonacci($maximum) -> $number { : state $count = 0; : take $number if $number < $maximum && $count++ < $terms; :

Re: Gather, take, newbie questions

2013-12-11 Thread David Warring
Hi Jacinta, I get a bit further with my build of Perl 6, which at least runs: % perl6 fib.pl 0 Are you maybe using an old Perl6? Try: % perl6 -e'say $*PERL' ("name" => "rakudo", "compiler" => {"name" => "rakudo", "ver" => "2013.11-22-g262e600", "release-number" => "", "build-date" => "2013-12-0