hello people, AÀM (Appel À Mousser) is the monthly social event of the Strasbourg(fr) LUG. the dates of those meetings are scheduled by an algorithm implemented in aam_dates_of_year (line 6).
Now i would like to show 25 AAM dates staring from 2019-01. line 14 works fine but is too long. i really would have those dates be read as a simple list. i wrote the line 18 (so i tought ) but when i want to get the 2 next dates, i have the dates for the 2 next years. it seems .flat is ignored and i don't know why. any help on it ? regards, marc 1 sub date_for (Date $d is copy, Int \dow) { 2 $d.=later(:1day) while $d.day-of-week != dow; 3 $d.later(:1week); 4 } 5 6 sub aam_dates_of_year ($year) { 7 ( for 1..12 { Date.new(:$year, :$^month, :1day) } ) 8 Z[&date_for] | (2..4) xx * 9 } 10 11 # works: 12 # Date.today.year.&aam_dates_of_year[7].say; 13 # (2019..2025)>>.&aam_dates_of_year.flat>>.say; 14 # ( lazy gather for 2019..∞ { take .&aam_dates_of_year }).flat.head(2)>>.say; 15 16 # more reusable ? 17 18 my @future_aams = 19 lazy gather for 2019..∞ { take .&aam_dates_of_year }; 20 21 @future_aams.flat.head(1)>>.say;