Path: utzoo!attcan!uunet!willett!ForthNet From: ForthNet@willett.UUCP (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: Data Structures Message-ID: <1063.UUL1.3#5129@willett.UUCP> Date: 2 Jun 90 04:33:05 GMT Organization: Latest link in the ForthNet chain. (Pgh, PA) Lines: 47 Category 3, Topic 20 Message 92 Thu May 31, 1990 W.BADEN1 [Wil] at 21:07 PDT Here is a vanilla algorithm for Easter. ( Easter is the first Sunday strictly after the ) ( Paschal Full Moon.) : golden# ( year -- n) 19 MOD ( n) 1+ ; : centuryterm ( year -- n) 100 / ( n) DUP >R 4 / R@ 11 + 8 * 25 / + R> - ; : paschalfullmoon ( year -- marchDay) DUP golden# >R centuryterm ( n) R@ 11 * + 30 MOD DUP 0= ( n f) OVER 1 = ( n f f') R> 11 AND OR ( n f) - ( n) 50 - NEGATE ; : easter ( year -- mo da) DUP >R paschalfullmoon ( n) 3 OVER ( n mar n) R> wday - ( n) 7 + 31 /MOD ( d m) 3 + SWAP ; Given month day year "wday" yields the day of week. (0 is Sunday.) Your system may already have something for this. The following is for the Gregorian calendar. ( For convenience the year begins with March 1.) : yday ( month day anyYear -- dayOfYear year) ROT ( day year month) 3 - DUP 0< IF -1 +under 12 + THEN 306 * 5 + 10 / +under ; : cday ( month day anyYear -- dayOfCentury century) yday ( day year) 100 /MOD SWAP ( day century year) 1461 4 */ +under ; : wday ( month day anyYear -- dayOfWeek) cday ( day century) 4 MOD 2* 9 - - 0 7 UM/MOD DROP ; Procedamus in Pace. Wil. (If you don't have it already : +under ROT + SWAP ;) ----- This message came from GEnie via willett through a semi-automated process. Report problems to: uunet!willett!dwp or willett!dwp@hobbes.cert.sei.cmu.edu