Hi,
I think you mean:
my \golden = ( 1 + sqrt 5 ) / 2;
best,
Theo
Marc Chantreux schreef op 2017-03-13 14:28:
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
--
Theo van den Heuvel
Van den Heuvel HLT Consultancy