hello,

i saw a math show with my son and we tried to use perl6

* to demonstrate the fact that the ratio between the terms
  n and n-1 in the fibonnaci sequence gets closer to the golden number

* let him know how awesome is perl6

so i wrote

my \golden    = ( 1 / sqrt 5 ) / 2;
my \fib       = ( 1, 1, * + * ... * );
my \approx    = (gather for fib -> $a, $b { take $a / $b });
my \distances = approx.map(  abs golden - * );
say [>=] distances[^1000];

and it didn't work: i had to rewrite

        my \distances = approx.map(  abs golden - * );

to

        my \distances = approx.map({ abs golden - $_ });

which is not so appealing.

then my programs starts to burn cpu and gets nothing. this is because it
seems that gather isn't on demand so i moved the subscript [^1000]. this
works but isn't intellectually right anymore.

any idea to make it more appealing ?

regards

-- 
Marc Chantreux (eiro on github and freenode)
http://eiro.github.com/
http://eiro.github.com/atom.xml
"Don't believe everything you read on the Internet"
    -- Abraham Lincoln

Reply via email to