#!/usr/local/bin/kermit +
#
# e a s t e r - Calculates date of Easter for any year between 1900 and 2099.
# 
# Usage:   easter <year>
# Example: easter 2001
# C-Kermit 7.1 or later required.
# Reference: Scientific American, March 2001, p.80.
#
# Illustrates: kerbang scripts, S-Expressions, compound IF conditions,
# array initialization.
#
# Author: F. da Cruz, Columbia University, March 2001
#
dcl \&m[] = Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
if ( not def \%1 || not numeric \%1 ) exit 1 Usage: \%0 year
if ( < \%1 1900 || > \%1 2099 ) exit 1 "\%0: 1900 <= year < 2100"
(setq x \%1)
(setq a (mod x 19) b (truncate (/ x 100)) c (mod x 100))
(setq d (truncate (/ b 4)) e (mod b 4))
(setq g (truncate (/ (+ (* 8 b) 13) 25)))
(setq h (mod (+ (* a 19) b (- d) (- g) 15) 30))
(setq m (truncate (/ (+ a (* h 11)) 319)))
(setq j (truncate (/ c 4)) k (truncate (mod c 4)))
(setq l (truncate (mod (+ (* 2 e) (* 2 j) m (- k) (- h) 32) 7)))
(setq n (truncate (/ (+ h (- m) l 90) 25)))
(setq p (truncate (mod (+ h (- m) l n 19) 32)))
echo \fday(\m(x)\flpad(\m(n),2,0)\flpad(\m(p),2,0)) \m(p) \&m[n] \m(x)
exit
