> On Aug 9, 2019, at 9:34 AM, Marc Chantreux <e...@phear.org> wrote:
>
> hello people,
Hi Marc!
>
> 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 ?
—snip—
>
> 18 my @future_aams =
> 19 lazy gather for 2019..∞ { take .&aam_dates_of_year };
> 20
> 21 @future_aams.flat.head(1)>>.say;
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 .&aam_dates_of_year };
@future_aams.head(1)>>.say;
Medium answer: In refactoring line 14, you moved from .flat on a List to .flat
on an Array.
List and Array do not treat `.flat` the same way. E.g.:
$ perl6 -e 'say (<a b>, <c>).flat.elems'
3
$ perl6 -e 'say [<a b>, <c>].flat.elems'
2
Full answer coming when time allows. For such a small fix, it was surprisingly
effortful to figure out.
See https://docs.perl6.org/language/list#Itemization
—
Hope this helps,
Bruce Gray (Util of PerlMonks)