Re: flat a lazy gather ?

2019-08-10 Thread Marc Chantreux
hello Bruce, > Short answer: Add `flat` before `lazy in line 19, and remove `.flat` from > line 21. Like so: > my @future_aams = > flat lazy gather for 2019..∞ { take ._dates_of_year }; sure but i loose the ability to use @future_aams year by year. the best i i have

Re: flat a lazy gather ?

2019-08-09 Thread Bruce Gray
s. it seems .flat is ignored > and i don't know why. > > any help on it ? —snip— > > 18 my @future_aams = > 19 lazy gather for 2019..∞ { take ._dates_of_year }; > 20 > 21 @future_aams.flat.head(1)>>.say; Short answer: Add `flat` before `lazy in

flat a lazy gather ?

2019-08-09 Thread Marc Chantreux
# Date.today.year._dates_of_year[7].say; 13# (2019..2025)>>._dates_of_year.flat>>.say; 14 # ( lazy gather for 2019..∞ { take ._dates_of_year }).flat.head(2)>>.say; 15 16# more reusable ? 17 18my @future_aams = 19 lazy gather for 2019..∞ { take ._dat

Re: lazy gather?

2017-03-14 Thread Marc Chantreux
On Tue, Mar 14, 2017 at 03:16:40PM +0100, Andreas Mueller wrote: > > or in one line in REPL: > > ((1,1,*+* ... *).rotor(2=>-1).map:{[/] $_}) ... (*-*).abs < 1e-10 > > my \approx= fib.rotor(2 => -1).map: { .[1] ÷ .[0] }; both are awesome but i'll stick with the readable one :) thanks for

Re: lazy gather?

2017-03-14 Thread Andreas Mueller
X-PMX-Spam: Gauge=, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1000_LESS 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, BODY_SIZE_800_899 0, IN_REP_TO 0, LEGITIMATE_SIGNS 0, MSG_THREAD 0, NO_URI_HTTPS 0,

Re: lazy gather?

2017-03-14 Thread Siavash
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

Re: lazy gather?

2017-03-14 Thread Marc Chantreux
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;

Re: lazy gather?

2017-03-13 Thread Siavash
Hi, 「gather」 should work. What version of Perl 6 are you using? (run perl6 -v) 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:

Re: lazy gather?

2017-03-13 Thread Theo van den Heuvel
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

lazy gather?

2017-03-13 Thread Marc Chantreux
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 = (