Send Remind-fans mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.roaringpenguin.com/cgi-bin/mailman/listinfo/remind-fans
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Remind-fans digest..."
Today's Topics:
1. Follow-up on 'counting a recurring event' (Roger)
2. Re: Follow-up on 'counting a recurring event' (David F. Skoll)
3. Re: Follow-up on 'counting a recurring event' (David F. Skoll)
4. Re: Follow-up on 'counting a recurring event' (hymie!)
5. Re: Follow-up on 'counting a recurring event' (David F. Skoll)
6. Re: Follow-up on 'counting a recurring event' (hymie!)
7. Re: Follow-up on 'counting a recurring event' (David F. Skoll)
----------------------------------------------------------------------
Message: 1
Date: Tue, 23 Apr 2013 21:47:42 -0400
From: Roger <[email protected]>
To: [email protected]
Subject: [Remind-Fans] Follow-up on 'counting a recurring event'
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed
Stopping on a count of a recurring event is something I need to do and
in my search I found this entry:
http://lists.roaringpenguin.com/pipermail/remind-fans/2012/002820.html
Subsequently I came up with a procedure that seems to work for me and
maybe it will be of use to others:
PUSH-OMIT-CONTEXT
?OMIT 2013-05-19
SET SALSALESSON 0 # Doesn't appear to be required as seems to have
no effect
IF today() >= '2013-05-12'
?SET SALSALESSON
nonomitted('2013-05-12',today(),"Mon","Tue","Wed","Thu","Fri","Sat")
?IF SALSALESSON < 6
?REM FROM 2013-05-12 AT 18:00 DURATION 1:00 SKIP MSG Salsa Level 1
? #[SALSALESSON + 1] %3
ENDIF
?ENDIF
POP-OMIT-CONTEXT
Basically, it schedules 6 Sundays while skipping one on 2013-05-19.
P.S. I am using:
REMIND 03.01.13 (English version) Copyright 1992-1998 David F. Skoll
------------------------------
Message: 2
Date: Wed, 24 Apr 2013 09:09:03 -0400
From: "David F. Skoll" <[email protected]>
To: [email protected]
Subject: Re: [Remind-Fans] Follow-up on 'counting a recurring event'
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
On Tue, 23 Apr 2013 21:47:42 -0400
Roger <[email protected]> wrote:
PUSH-OMIT-CONTEXT
?OMIT 2013-05-19
SET SALSALESSON 0 # Doesn't appear to be required as seems to
have no effect
IF today() >= '2013-05-12'
?SET SALSALESSON
nonomitted('2013-05-12',today(),"Mon","Tue","Wed","Thu","Fri","Sat")
?IF SALSALESSON < 6
?REM FROM 2013-05-12 AT 18:00 DURATION 1:00 SKIP MSG Salsa
Level 1 ? #[SALSALESSON + 1] %3
ENDIF
?ENDIF
POP-OMIT-CONTEXT
That's fairly clever, but it can be simplified to:
PUSH-OMIT-CONTEXT
OMIT 2013-05-19
# Count Sundays from the week before first lesson
# until today. Use max(...) to avoid error if current
# date < 2013-05-05
SET SALSALESSON nonomitted('2013-05-05', max('2013-05-05', today()),
"Mon","Tue","Wed","Thu","Fri","Sat")
REM 2013-05-12 *7 UNTIL 2013-06-23 AT 18:00 DURATION 1:00 SKIP MSG Salsa Level
1 - #[SALSALESSON]
POP-OMIT-CONTEXT
Regards,
David.
------------------------------
Message: 3
Date: Wed, 24 Apr 2013 09:20:47 -0400
From: "David F. Skoll" <[email protected]>
To: [email protected]
Subject: Re: [Remind-Fans] Follow-up on 'counting a recurring event'
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII
Following up on myself...
That's fairly clever, but it can be simplified to:
It can be made even simpler and follow the Remind Zen:
PUSH-OMIT-CONTEXT
OMIT 2013-05-19
REM 2013-05-12 *7 UNTIL 2013-06-23 AT 18:00 DURATION 1:00 SKIP \
MSG Salsa Level 1 - #[nonomitted('2013-05-05', trigdate(),
"Mon","Tue","Wed","Thu","Fri","Sat")]
POP-OMIT-CONTEXT
Regards,
David.
------------------------------
Message: 4
Date: Wed, 24 Apr 2013 09:16:40 -0400
From: hymie! <[email protected]>
To: Users of Remind <[email protected]>
Subject: Re: [Remind-Fans] Follow-up on 'counting a recurring event'
Message-ID: <[email protected]>
"David F. Skoll" writes:
REM 2013-05-12 *7 UNTIL 2013-06-23 AT 18:00 DURATION 1:00 SKIP
MSG Salsa Level 1 - #[SALSALESSON]
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".
--hymie! http://lactose.homelinux.net/~hymie [email protected]
-------------------------------------------------------------------------------
------------------------------
Message: 5
Date: Wed, 24 Apr 2013 09:57:33 -0400
From: "David F. Skoll" <[email protected]>
To: [email protected]
Subject: Re: [Remind-Fans] Follow-up on 'counting a recurring event'
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII
On Wed, 24 Apr 2013 09:16:40 -0400
hymie! <[email protected]> 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.
# 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
Regards,
David.
------------------------------
Message: 6
Date: Wed, 24 Apr 2013 10:55:45 -0400
From: hymie! <[email protected]>
To: Users of Remind <[email protected]>
Subject: Re: [Remind-Fans] Follow-up on 'counting a recurring event'
Message-ID: <[email protected]>
"David F. Skoll" writes:
On Wed, 24 Apr 2013 09:16:40 -0400
hymie! <[email protected]> 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 [email protected]
-------------------------------------------------------------------------------
------------------------------
Message: 7
Date: Wed, 24 Apr 2013 11:02:33 -0400
From: "David F. Skoll" <[email protected]>
To: [email protected]
Subject: Re: [Remind-Fans] Follow-up on 'counting a recurring event'
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII
On Wed, 24 Apr 2013 10:55:45 -0400
hymie! <[email protected]> wrote:
Now here's my next question ... can I make this a "function" where I
can just call
SetUpLessons("Salsa level 1",'2013-05-12',6)
Unfortunately not.
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)]
That's about the best you can do.
Regards,
David.
------------------------------
_______________________________________________
Remind-fans mailing list
[email protected]
http://lists.roaringpenguin.com/cgi-bin/mailman/listinfo/remind-fans
Remind is at http://www.roaringpenguin.com/products/remind
End of Remind-fans Digest, Vol 109, Issue 1
*******************************************