I suggest using lp instead of l as a local name to
avoid confusion with the number 1.



----- Original Message -----
From: Raul Miller <[EMAIL PROTECTED]>
Date: Tuesday, May 29, 2007 5:30 pm
Subject: Re: [Jprogramming] day numbers

> On 5/29/07, Chris Burke <[EMAIL PROTECTED]> wrote:
> > Let me know if you can speed this up significantly.
> 
> Perhaps something like:
> 
> day=: 3 : 0
>  'y m d'=. |: y
>  Y=.~.,y
>  i=.Y i.y
>  l=. i { -/ 0 = 4 100 400 |/ Y
>  md=. (l * m > 2) + m { 0 0 31 59 90 120 151 181 212 243 273 304 334
>  Yd=. (365*Y) + -/"1 <. (Y-1) %/ 4 100 400
>  |: d + md + i { Yd - 657437
> :
>  if. x do. day 0 100 100#: y else. day y end.
> )
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to