date stuff in gnucash

Dave Peticolas dave@krondo.com
Tue, 28 Nov 2000 13:27:37 -0800


James LewisMoss writes:
> >>>>> On Tue, 28 Nov 2000 12:04:51 -0800, Dave Peticolas <dave@krondo.com> sa
> id:
> 
>  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".

To my functionally-minded view, the second is just a generalization
of the first. Conceptually, they are the same thing, if perhaps
requiring different implementatioins.

dave