-
Notifications
You must be signed in to change notification settings - Fork 4
Description
The is-between? primitive has some unintuitive (to me, wrong) behavior when handling logotimes of type DAY (e.g., "7/3"). Its format is:
show time:is-between? day1 day2 day3
which reports TRUE if day1 is between day2 and day3.
It works as expected when day2 is less than day3, but not when day2 is greater than day3. For example (pseudocode):
time:is-between? 2/1 1/1 3/1 reports TRUE, as expected. But
time:is-between? 2/1 12/1 3/1 reports FALSE, which is not what I would expect, because Feb. 1 is between last December and this March.
It appears that is-between? always reports FALSE if day3 is earlier in the year than day2. That means it is not useful for asking "Is today between December 1 of last year and March 1 of this year?".
Most importantly, the User Manual documentation does not explain what happens in this case. The simplest solution is to add to the User Manual description of is-between? to say "When used with arguments of type DAY, is-between? always reports FALSE if logotime2 is later in the year than logotime3."
However, the primitive would be more useful if instead the User Manual said this and the code implemented it:
"When is-between? is used with arguments of type DAY, and logotime2 is later in the year than logotime3, then it reports TRUE if logotime1 is between the day of logotime3 of the previous year and logotime2 of the current year. For example, if logotime2 represents December 1 and Logotime3 represents February 1, then is-between? reports TRUE when logotime1 represents January 1, but reports FALSE if logotime1 represents either November 15 or February 15."
The User Manual also needs to make it clear that when using logotimes of type DATETIME and DATE, is-between? does not raise a runtime error if logotime3 is before logotime2 but instead reports FALSE.