[Jprogramming] comparison
Raul Miller
rauldmiller at gmail.com
Sun Apr 8 04:26:13 HKT 2007
On 4/7/07, Brian Schott <schott.brian at gmail.com> wrote:
> Person A's birthday is Feb 5th
> Person B's birthday is Sep 5th
>
> Their birtday's are 5 or 7 months apart depending on
> something (which I can't quite express); and how can this be
> represented/computed in code?
You've already got several guesses at what you intend..
Here's how I'd approach this:
bmonthA=: 1980 2
bmonthB=: 1980 7
bmonthB -&(0 12&#.) bmonthA
5
bmonthC=:1979 7
bmonthA -&(0 12&#.) bmonthC
7
Put differently: celebrations of person A's birthday occur
on Feb 5th, but if you are concerned about the day person A
was born you need to be more specific. Alternatively, if you
are only concerned about the relative time from one instance
of a birthday celebration to the next, it probably matters which
birthday is the "current birthday".
--
Raul
More information about the Programming
mailing list