For Programmers: Free Programming Magazines  


Home > Archive > APL > February 2008 > leapyear









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author leapyear
jk

2008-02-26, 6:59 pm

Is 2008 a leapyear? ... almost a trivial question.

Anthony Camacho (I believe Manchester 1986) has provided an interesting
paper on a couple of subjects, among others the swastika and the
leapyear.

Despite it's relative triviality I love the APL/J algorithm.

Here is the J-version:
Are the years in arg leapyears?
2|+/0=4 100 400|/ arg

How many days in the years in arg
365+2|+/0=4 100 400|/arg

How many days in February of the years in arg
28+2|+/0=4 100 400|/ arg

Selecting the leapyears from the years in arg
(2|+/0=4 100 400|/ arg) # arg

Lovely!

An article on the subjects from some 10 years ago (forget the language - it's
Dutch)
http://www.ganuenta.com/leap.pdf

________________________________________
_________________
Jan Karman
http://www.ganuenta.com




Stephen Taylor

2008-02-27, 4:06 am

I'm fond too of the following in Dyalog. There are shorter ways to
write daysin, but I'm seduced by lucidity.

=E2=8D=9D is =E2=8D=B5 a leap year?
leap=E2=86=90{0 2=E2=88=8A=E2=8D=A8+=E2=8C=BF=C3=974 100 1000=E2=88=98.|=E2=
=8D=B5}

=E2=8D=9D m daysin y
daysin=E2=86=90{=E2=8D=B5[=E2=8D=BA]}=E2
=88=98{31 =E2=8D=B5 31 30 31 30 31 3=
1 30 31 30 31}=E2=88=98{28+leap =E2=8D=B5}

and for those whose email clients mangle Unicode:

leap <- {0 2 {member}{commute} +/[1] =C3=974 100 1000 =C2=B0.| w}

daysin <- {w[a]}=C2=B0{31 w 31 30 31 30 31 31 30 31 30 31}=C2=B0{28+leap w}


Stephen Taylor
editor@vector.org.uk
jk

2008-02-27, 7:59 am

The worries did start in 1997, the first year after the last leapyear: THE
MILLENNIUM crisis - for god's sake - they really got worried ...!!
Does anybody know wether they have "already" a solution for
The next date crisis, by R.L. Glass, ACM Communications, jan. 1997?

jk


"Stephen Taylor <editor@vector.org.uk>" <StephenTaylorFRSA@googlemail.com> wrote
in message
news:be51d3fe-93a6-46aa-b889-5b7b3334e09b@i12g2000prf.googlegroups.com...
I'm fond too of the following in Dyalog. There are shorter ways to
write daysin, but I'm seduced by lucidity.

? is ? a leap year?
leap?{0 2??+?×4 100 1000?.|?}

? m daysin y
daysin?{?[?]}?{31 ? 31 30 31 30 31 31 30 31 30 31}?{28+leap ?}

and for those whose email clients mangle Unicode:

leap <- {0 2 {member}{commute} +/[1] ×4 100 1000 °.| w}

daysin <- {w[a]}°{31 w 31 30 31 30 31 31 30 31 30 31}°{28+leap w}


Stephen Taylor
editor@vector.org.uk



Gosi

2008-02-27, 6:58 pm

On Feb 27, 12:07=A0pm, "jk" <*a...@planet.nl (remove the asterisks)>
wrote:
> The worries did start in 1997, the first year after the last leapyear: THE=


> MILLENNIUM crisis - for god's sake - they really got worried ...!!


I am not sure who they were.
You are probable refering to innocent computer customers.
I do know there were a lot of so called experts trying to sell their
services and new equipment and used FUD as usual.

Lots of people had meeting after meeting about this and some computer
manufacturers managed to sell quite a lot of equipment and software.

Amazingly computer companies use the FUD in many various ways.
Best way when these so called experts tell you something silly is to
ask for written documentation which in most cases does not exist or if
at all written down then it is written by innocent bystanders that
have been fooled by those false FUD talks.

Most of the big computer and software comapanies are masters of
spreading FUD about their competitors.

I have to say that the Millennium crisis was a very successful FUD

FUD =3D Fear Uncertainty and Doubt
jk

2008-02-27, 6:58 pm

Björn,
not just computer companies, all the media, governments, scientists (thank god
they have now the climate-crisis) , all programmers, systems-analists and all
their managers and secreataries, and what have you, did.

only a handful of smart and alert ordinary guys did not ...

jk

"Gosi" <gosinn@gmail.com> wrote in message
news:d2365910-9e65-4b39-a4c8-d2012ff37677@d4g2000prg.googlegroups.com...
On Feb 27, 12:07 pm, "jk" <*a...@planet.nl (remove the asterisks)>
wrote:
[color=darkred]
> I am not sure who they were.
> You are probable refering to innocent computer customers.
>I do know there were a lot of so called experts trying to sell their
> services and new equipment and used FUD as usual.




Kerry Liles

2008-02-27, 6:58 pm

While I have to agree that the Y2K version of "the sky is falling" overture
was much overplayed, there were many customers that I encountered who had
legitimate date handling problems that were brought to light by Y2K
investigations. Of course, much of that was related to poor design choices
made a number of days [or years or decades] prior to Y2K, but they would
have broken in many different ways with corresponding unaccpetable results.
A lot of the cleanup forced by Y2K was long overdue and merely brought to a
boil.

regards all,

Kerry Liles


"jk" <*axy*@planet.nl (remove the asterisks)> wrote in message
news:47c576ee$0$25477$ba620dc5@text.nova.planet.nl...
> Björn,
> not just computer companies, all the media, governments, scientists (thank
> god they have now the climate-crisis) , all programmers, systems-analists
> and all their managers and secreataries, and what have you, did.
>
> only a handful of smart and alert ordinary guys did not ...
>
> jk
>
> "Gosi" <gosinn@gmail.com> wrote in message
> news:d2365910-9e65-4b39-a4c8-d2012ff37677@d4g2000prg.googlegroups.com...
> On Feb 27, 12:07 pm, "jk" <*a...@planet.nl (remove the asterisks)>
> wrote:
>
>
>
>



Phil Last

2008-02-27, 6:58 pm

On Feb 27, 12:07 pm, "jk" <*a...@planet.nl (remove the asterisks)>
wrote:
> The worries did start in 1997, the first year after the last leapyear: THE=


> MILLENNIUM crisis - for god's sake - they really got worried ...!!
> Does anybody know wether they have "already" a solution for
> The next date crisis, by R.L. Glass, ACM Communications, jan. 1997?
>
> jk
>
> "Stephen Taylor <edi...@vector.org.uk>" <StephenTaylorF...@googlemail.com>=

wrote
> in messagenews:be51d3fe-93a6-46aa-b889-5b7b3334e09b@i12g2000prf.googlegrou=

ps.com...
> I'm fond too of the following in Dyalog. There are shorter ways to
> write daysin, but I'm seduced by lucidity.
>
> ? is ? a leap year?
> leap?{0 2??+?=C3=974 100 1000?.|?}
>
> ? m daysin y
> daysin?{?[?]}?{31 ? 31 30 31 30 31 31 30 31 30 31}?{28+leap ?}
>
> and for those whose email clients mangle Unicode:
>
> leap <- {0 2 {member}{commute} +/[1] =C3=974 100 1000 =C2=B0.| w}
>
> daysin <- {w[a]}=C2=B0{31 w 31 30 31 30 31 31 30 31 30 31}=C2=B0{28+leap w=

}
>
> Stephen Taylor
> edi...@vector.org.uk



I was a bit worried by JK's 4 100 400|/
I'm not saying it's wrong. I just wasn't sure what dialect it was in.
I though perhaps it was an n-wise residue reduction.

My favourite leap calc is
leap=E2=86=90{0=3D.=3D1 4 100 400=E2=88=98.|=E2=8D=B5}

Phil
jk

2008-02-27, 6:58 pm


"Phil Last" <phil.last@ntlworld.com> wrote in message
news:c56c83c0-a713-440c-9cf4-c0ecdf8c407b@s13g2000prd.googlegroups.com...
On Feb 27, 12:07 pm, "jk" <*a...@planet.nl (remove the asterisks)>
wrote:
> The worries did start in 1997, the first year after the last leapyear: THE
> MILLENNIUM crisis - for god's sake - they really got worried ...!!
> Does anybody know wether they have "already" a solution for
> The next date crisis, by R.L. Glass, ACM Communications, jan. 1997?
>
> jk
>
> "Stephen Taylor <edi...@vector.org.uk>" <StephenTaylorF...@googlemail.com>
> wrote
> in
> messagenews:be51d3fe-93a6-46aa-b889-5b7b3334e09b@i12g2000prf.googlegroups.com...
> I'm fond too of the following in Dyalog. There are shorter ways to
> write daysin, but I'm seduced by lucidity.
>
> ? is ? a leap year?
> leap?{0 2??+?×4 100 1000?.|?}
>
> ? m daysin y
> daysin?{?[?]}?{31 ? 31 30 31 30 31 31 30 31 30 31}?{28+leap ?}
>
> and for those whose email clients mangle Unicode:
>
> leap <- {0 2 {member}{commute} +/[1] ×4 100 1000 °.| w}
>
> daysin <- {w[a]}°{31 w 31 30 31 30 31 31 30 31 30 31}°{28+leap w}
>
> Stephen Taylor
> edi...@vector.org.uk



I was a bit worried by JK's 4 100 400|/
I'm not saying it's wrong. I just wasn't sure what dialect it was in.
I though perhaps it was an n-wise residue reduction.

My favourite leap calc is
leap?{0=.=1 4 100 400?.|?}

Phil


Phil,
It's J for Windows V2.06 Personal Edition (still sealed)
jk


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com