On Wed, May 2, 2018 at 3:44 AM, Elizabeth Mattijsen <l...@dijkmat.nl> wrote:

> Getting back to maybe your original question: if you want the date 7 days
> from now, you can just use integer arithmetic:
>
> $ 6 'say Date.today + 7'
> 2018-05-09
>

Oh, I knew that; that was just an example.

My actual code involved finding the date of the next Tuesday after today,
for which I originally wrote:

    my $next-tuesday = (Date.today ... *.day-of-week == 2).tail;

It bugged me a bit stylistically that the parentheses gave prominence to
the entire sequence when all I really wanted was the final element.  So I
played with it a big until I got:

    my $next-tuesday = first *.day-of-week == 2, Date.today .. *;

That's when I accidentally left off the third period and found that it
still worked.

Reply via email to