From: Jim Weigang <>
Newsgroups: comp.lang.apl
Date: Wed, 22 Apr 1998 12:05:01 -0400
Subject: Re: Sunshine At The Cygnets In Our Waters

On April 21, Tomas Gustafsson wrote:

> Someone who knows how to calculate the time of sunrise and sunset, based on
> date and location?

I've had the following program in my INI0 workspace for I don't know how
long, where it displays the times of sunrise and sunset (and moonrise and
moonset, along with a little 1-D ASCII plot of these events) every time
I start APL.

I made no effort to APLify this program or even understand the algorithm
when converting it from Basic, so it's not showcase APL code, but it
works.  For other astronomical programs, see Sky & Telescope's website,
at  (A good place to visit the next time the
media tells you the sky is falling!)

(This program is just too big and ugly to bother reproducing in its entireity as a graphic image. The full source code is in the hidden APLASCII comment, so you can extract it if you'd like to use the program.)

At startup, I display a line like the following:

  Sunrise is at 5:59 today, sunset at 7:40.  (13.7 hours of sunlight.)

The code that does this is:


From: Jim Weigang <> To: Ted Edwards <> Newsgroups: comp.lang.apl Date: Sat, 25 Apr 1998 01:39:08 -0400 Subject: Re: Sunshine At The Cygnets In Our Waters Ted Edwards wrote on April 23: > I do not have an algorithm for moon rise/set. Could you post that one? Sure. Same deal as SUNRISE: no attempt was made to APLify the code when translating from the BASIC; not pretty, but it works.
(Again, the full source code is in the hidden APLASCII comment.)


Note: The APL code on this page can be extracted without you having to retype it.
See "Downloading Code" for instructions.

JimW's Home Page