[Remind-Fans] New stuff in master (was Re: Repeat every six months)
Ian! D. Allen
idallen at idallen.ca
Sat Mar 5 03:17:06 EST 2022
This clever solution is why we pay you the big bucks:
On Fri, Mar 04, 2022 at 03:51:56PM -0500, Dianne Skoll via Remind-fans wrote:
> But I'm making changes (which you can
> preview at git master) that add a "trig" function. So
> for the every-six-months case, you can write:
>
> REM [trig("1 --1 April", "1 --1 October")] MSG Last day of March/Sep
> REM [trig("Mon June", "Mon July")] MSG Mondays in June and July
> REM [trig("Jan", "Feb", "Mar")] MSG Every day in January through March
> REM [trig("Jan", "Mar") && trig("1", "5", "15")] MSG 1st, 5th, 15th of Jan and Mar
>
> Basically: trig() takes any number of arguments. It evaluates each of
> them as a trigger, and returns the trigger date of the *first* one that
> would trigger today. If none of them would trigger today, returns the
> zero-day of the epoch, which is 1990-01-01.
The above function improves readability and reduces duplication. Woo hoo!
Now, how hard would it be to add syntactic sugar so that a syntax like
the one below might translate to the above trig() calls?
REM 1 --1 April OR 1 --1 October MSG Last day of March/Sep
REM Mon June OR Mon July MSG Mondays in June and July
REM Jan OR Feb OR Mar MSG Every day in January through March
REM ( Jan OR Mar ) AND ( 1 OR 5 OR 15 ) MSG 1st, 5th, 15th of Jan and Mar
Also, how about adding "LASTDAY March" as syntactic sugar for "1 --1 April"?
It's maddening that something as simple as "last day of month" has to
specify the name of the *following* month.
--
| Ian! D. Allen, BA-Psych, MMath-CompSci idallen at idallen.ca Ottawa CANADA
| Home: www.idallen.com Contact Improvisation Dance: www.contactimprov.ca
| Former college professor of Free/Libre GNU+Linux @ teaching.idallen.com
| Improve democracy www.fairvote.ca and defend digital freedom www.eff.org
More information about the Remind-fans
mailing list