date stuff in gnucash

Dave Peticolas
Tue, 28 Nov 2000 12:04:51 -0800

James LewisMoss writes:
>  Dave> I tend to think of abstract dates as functions from absolute
>  Dave> dates to absolute dates. So, "last monday in a month" would be
>  Dave> a function that, given a date X, returns the date of the last
>  Dave> monday of the month in which X occurs.
> I was thinking in my head more of a function that gives me the next
> date after an absolute date that conforms to the abstract date and a
> function that says whether an absolute date is an instance of the
> abstract date.  Maybe also a function that tells the previous absolute
> date that conforms to an abstract date.

That's probably a better formulation for abstract dates. In fact, it
really subsumes both what you have termed 'abstract' and 'relative' so
that there is no real difference between them.

The question 'is an absolute date an instance of the abstract date'
becomes 'is the absolute date in the range of the function which maps
absolute dates to next absolute dates', which is meaningful for both
'absolute' and 'relative' dates. For many 'relative' dates, the answer
is yes for all absolute dates, but that is not always the case. For
example, the relative date 'three weekdays' has all the weekdays as
valid absolute dates.

> Too long out of school.  Define "projection" please.  Composition I
> remember. :)

Example: f: Date --> (Date, Date)

         F: Date --> Date where F (X) = Y iff f (X) = (Y, Z) for some Z
F is a projection of f.