Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #35983
| From | "Rod Pemberton" <buzz@notnotnontnooatno.cmm> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: When Gregorian replaced Julian |
| Date | 2015-01-23 20:23 -0500 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <op.xsx0ssqlv6dtjm@localhost> (permalink) |
| References | <m9s42m$n26$1@dont-email.me> |
On Thu, 22 Jan 2015 19:19:34 -0500, WJ <w_a_x_man@yahoo.com> wrote: > Using cal, find the month when England adopted the Gregorian > calendar. > > In Emacs Lisp: > > (catch 'exit > (dolist (year (number-sequence 1750 1799)) > (princ year) > (dolist (month (number-sequence 1 12)) > (let* ((cal (shell-command-to-string (format "cal %s %s" month > year))) > (num-days (length (cdr (split-string cal "[^0-9]+" t))))) > (princ (format " %s" num-days)) > (when (< num-days 28) > (terpri) (princ cal) > (throw 'exit 0)))) > (terpri))) > > Output: > > 1750 31 28 31 30 31 30 31 31 30 31 30 31 > 1751 31 28 31 30 31 30 31 31 30 31 30 31 > 1752 31 29 31 30 31 30 31 31 19 > September 1752 > S M Tu W Th F S > 1 2 14 15 16 > 17 18 19 20 21 22 23 > 24 25 26 27 28 29 30 > > Show your Forth code. Which "cal" program are you talking about? Is this for Linux? ... You really shouldn't assume that a Gregorian calendar program will stop returning dates simply because there were no Gregorian dates prior to a certain date or because some country adopted the calendar on a certain date. Most Gregorian calendar programs will continue to return dates far back in time until they overflow their variables. Rod Pemberton
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
When Gregorian replaced Julian "WJ" <w_a_x_man@yahoo.com> - 2015-01-23 00:19 +0000 Re: When Gregorian replaced Julian Mark Wills <markwills1970@gmail.com> - 2015-01-23 01:57 -0800 Re: When Gregorian replaced Julian "Rod Pemberton" <buzz@notnotnontnooatno.cmm> - 2015-01-23 20:23 -0500 Re: When Gregorian replaced Julian "WJ" <w_a_x_man@yahoo.com> - 2015-01-24 06:32 +0000
csiph-web