logoalt Hacker News

aidenn0today at 3:48 AM0 repliesview on HN

The cambridge site linked from TFA appears to be hugged-to-death, but I found something that appears to be the same code, under an apache license[1]

I modified that to work under SBCL (but with style-warnings), and fixed up the first example from TFA to actually be free of style-warnings even under sbcl[2]

NB: The code from the book is exceedingly non-idiomatic lisp. In addition, many of the constants violate the (rather strict) ANSI rules around defining constants, so I worked around that by making them special variables (i.e. s/defconstant/defparameter/). A lot could be done to clean things up and allow faster calculations, but finding all ramadan/ash-wednesday correlations in a 5000 (not a typo 10x what TFA does) takes under 1ms on my machine, so shrug

The code from TFA is much, much worse than the code in calendar.l, but there was less of it so I could fix it up a bit more.

1: https://github.com/EdReingold/calendar-code2/blob/main/calen...

2: https://gist.github.com/jasom/1338543679a596449c324eddf716cc...