date stuff in gnucash

James LewisMoss
28 Nov 2000 12:05:21 -0500

>>>>> On Tue, 28 Nov 2000 00:49:08 -0800, Dave Peticolas <> said:

 Dave> James LewisMoss writes:
 >> An abstract date points to a real date, but not a particular one.
 >> "Last monday in a month" has a real occurrence (12 a year in
 >> fact).  A relative date isn't a real date.  It's a difference.
 >> You can't say "give me an absolute date that conforms to this
 >> relative date".  You can with an abstract date.

 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.

 Dave> A relative date is a function from absolute dates to pairs of
 Dave> absolute dates. So, "2 weeks" would be a function that, given a
 Dave> date X, returns (Y, Z) where Y is 2 weeks before X and Z is two
 Dave> weeks after X.

Could also be a function on an abstract date: "Two weeks after the
first monday in the month".

 Dave> You can turn a relative date into an abstract date by just
 Dave> projecting the result to either the first or second member of
 Dave> the pair, depending on whether you want to add or subtract.

Agreed.  You can programatically treat relative dates and abstract
dates quite similarly, but conceptually, they are not the same thing.
I can see explaining these two things to someone making a budget, but
I can't see explaining the concepts together.

 Dave> In this conceptualization, you can combine abstract dates
 Dave> arbitrarily using funcition composition. And adding a relative
 Dave> date to an abstract date is just projection and composition.

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

 Dave> I think this conceptualization might be usefuly adapted to an
 Dave> implementation, given the ease with which functions are
 Dave> manipulated in scheme.

Agreed, but for the moment I'm more interested in date concepts that
could be useful that I might be missing.  Implementation is another


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