Note that you can also use a map:

my \approx    = fib.rotor(2 => -1).map: { .[1] ÷ .[0] };

On 2017-03-14 09:00:34 GMT, Marc Chantreux wrote:
> On Mon, Mar 13, 2017 at 08:33:05PM +0330, Siavash wrote:
>> I may be wrong, but I think the code should be:
>> my \golden    = (1 + sqrt 5) ÷ 2;
>> my \fib       = 1, 1, * + * ... ∞ ;
>> my \approx    = gather for fib.rotor(2 => -1) { take .[1] ÷ .[0] };
>> my \distances = approx.map: (golden - *).abs;
>> say distances[^1000];
>
> excellent! i updated my perl6 and tested this code and it works well!
> thank you everyone.

Reply via email to