date stuff in gnucash

James LewisMoss
28 Nov 2000 16:13:41 -0500

>>>>> On Tue, 28 Nov 2000 12:04:51 -0800, Dave Peticolas <> said:

 Dave> James LewisMoss writes: I tend to think of abstract dates as
 Dave> functions from absolute dates to absolute dates. So, "last
 Dave> monday in a month" would be a function that, given a date X,
 Dave> returns the date of the last monday of the month in which X
 Dave> 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.

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

Not entirely true.  A absolute date can be an instance of an abstract
date, but it can't be an instance of a relative date.  I still see a
distinct difference when thinking about the two (implementation aside).

A simple implementation of the "is an absolute date an instance of the
abstract date" would be to find the next absolute date that conforms
to an abstract date and see if it is the same absolute date.  If so
then it's an instance.

You can't really do that.  What you'd do instead is ask "is there an
absolute date that when combined with this relative date gives the
absolute date in question".

So I see there still being a difference in what you can do with a
relative and an absolute date (consider here that my mind tends to
work in the OO world which is a bit different from the functional
world (functional being my second ring :)).

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

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

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

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

hmm. so (define (F dt) (car (f dt)))? :)


@James LewisMoss <>      |  Blessed Be!
@ |  Linux is kewl!
@"Argue for your limitations and sure enough, they're yours." Bach