On 4/7/07, Brian Schott <[EMAIL PROTECTED]> wrote:
        And I like the generality of these two answers
below, when the days within the months are a little
different. I am still working on how to choose between the
two possibilities. The second alternative is correct in this
case.

   (-~,-)/&.(12 28&#.) 2 5,:9 6   NB. 28 days in Feb
7  1
4 27
   (-~,-)/&.(12 30&#.) 2 5,:9 6   NB. 30 days in Sep
7  1
4 29

I'm not sure what you mean by "correct". Generally, if
you're abstracting on months you either should ignore
exact days or you also should include year.

  require 'dates'
  -/todayno(0 _1 +/1980}.i.1990),"0 1]2 5,:9 6
152 152 152 152 152 152 152 152 152 152
  -/todayno(0 0 +/1980}.i.1990),"0 1]9 6,:2 5
214 213 213 213 214 213 213 213 214 213

There seem to be either 213 or 214 days from Feb 5 through
Sep 6 (depends on leap year) and 152 days going the other
direction.

--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to