[Remind-Fans] Follow-up on 'counting a recurring event'

hymie! hymie at lactose.homelinux.net
Wed Apr 24 10:55:45 EDT 2013


"David F. Skoll" writes:
>On Wed, 24 Apr 2013 09:16:40 -0400
>hymie! <hymie at lactose.homelinux.net> wrote:
>
>> I think the original goal was not to have to calculate by hand the
>> "until" date, but to specify "6 sessions", and have the end date
>> adjust itself based on intervening "omits".
>
>Oh, I see.  That makes sense, then.  It can be done like this, though
>it's a bit inefficient; Remind will spin its wheels trying to satisfy
>the SATISFY clause after the last lesson.  Luckily, modern computers
>are so fast you don't even notice it.

I see the same inefficiency in the original code as well.  I suppose
it would be best to remove/comment out the code or add an ending date
after the class is finished  Or perhaps select a worst-case end date
>REM 2013-05-12 *7 UNTIL 2013-12-01 AT 18:00 DURATION 1:00 SKIP   

># Count the lesson number starting from date "x"
>FSET lesson_num(x) nonomitted(x, trigdate(), "Mon","Tue","Wed","Thu","Fri","Sat")
>
>PUSH-OMIT-CONTEXT
>OMIT 2013-05-19
># 6 lessons, hence "<=6" in SATISFY clause
>REM 2013-05-12 *7 AT 18:00 DURATION 1:00 SKIP   \
>  SATISFY [lesson_num('2013-05-05') <= 6]         \
>  MSG Salsa Level 1 - #[lesson_num('2013-05-05')]
>POP-OMIT-CONTEXT

Awesome.  My only issue would be, for the sake of re-use, that the
date in the REM statement is different than the date given to the
lesson_num function.  So I changed it thusly:
>FSET lesson_num(x) 1 + nonomitted(x, trigdate(), "Mon","Tue","Wed","Thu","Fri","Sat")
>REM 2013-05-12 *7 AT 18:00 DURATION 1:00 SKIP   \
>  SATISFY [lesson_num('2013-05-12') <= 6]         \
>  MSG Salsa Level 1 - #[lesson_num('2013-05-12')]

Now here's my next question ... can I make this a "function" where I
can just call
PUSH-OMIT-CONTEXT
OMIT 2013-05-19
SetUpLessons("Salsa level 1",'2013-05-12',6)
SetUpLessons("Salsa level 2",'2013-07-01',8)
POP-OMIT-CONTEXT

and have it do what I want?  I don't see anything in the man page about
"subroutines" or "procedures", and the SET and FSET (as far as I can tell)
only return values, not REM statements.

Here is the closest I got:

SET start '2013-02-13'
SET class "Salsa level 1"
SET numlesson 6
rem [start] *7 skip satisfy [lesson_num(start) <= numlesson] \
    MSG [class] - #[lesson_num(start)]

SET start '2013-04-03'
SET class "Salsa level 2"
SET numlesson 8
rem [start] *7 skip satisfy [lesson_num(start) <= numlesson] \
    MSG [class] - #[lesson_num(start)]

--hymie!    http://lactose.homelinux.net/~hymie    hymie at lactose.homelinux.net
-------------------------------------------------------------------------------


More information about the Remind-fans mailing list