or in one line in REPL:

  ((1,1,*+* ... *).rotor(2=>-1).map:{[/] $_}) ... (*-*).abs < 1e-10

  -am

On 14.03.17 12:37, Siavash wrote:
> 
> 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.

-- 
Andreas Müller - Raum: 35/114b - Tel: 2875

Reply via email to