moon-phase added by C-Keen on Thu Apr 5 12:55:16 2012

;; Ben Daglish's simple method, see http://www.ben-daglish.net/moon.shtml
;; Returns the phase day (0 to 29, where 0=new moon, 15=full etc.) for
;; the selected date.
(use srfi-19)
(define (moon-phase year month day)
  (let ((lunar-phase 2551443)
        (new-moon 588900000)
        (date (time->milliseconds
               (date->time (date-subtract-duration
                            (make-date 0 0 0 0 day month year)
                            (make-duration #:months 1))))))
    (inexact->exact (add1 (floor (/ (modulo (/ (- date new-moon) 1000) lunar-phase)
                                    (* 24 3600)))))))