2 comments

  • aidenn03 hours ago
    They probably want to replace the header of calendar.l with something roughly like:<p><pre><code> (defpackage &quot;CC4&quot; (:use &quot;COMMON-LISP&quot;) (:export :acre :advent :akan-day-name :akan-day-name-on-or-before [and so on for a few hundred lines] :yom-ha-zikkaron :yom-kippur :zone )) (in-package &quot;CC4&quot;) </code></pre> Note that :acre could also be &#x27;acre or #:acre or &quot;ACRE&quot;; any string-designator[1] will do. If there are really a few hundred of them then #:acre or &quot;ACRE&quot; has advantages (the other two ways intern symbols).<p>&gt; believe the problem with the unedited code has something to do with packages and namespaces<p>Since &quot;package&quot; is what Common Lisp calls namespaces, the &quot;and namespaces&#x27; is redundant, but the general thrust is correct.<p>1: <a href="https:&#x2F;&#x2F;www.lispworks.com&#x2F;documentation&#x2F;HyperSpec&#x2F;Body&#x2F;26_glo_s.htm#string_designator" rel="nofollow">https:&#x2F;&#x2F;www.lispworks.com&#x2F;documentation&#x2F;HyperSpec&#x2F;Body&#x2F;26_gl...</a>
  • aidenn02 hours ago
    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]<p>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]<p>NB: The code from the book is <i>exceedingly</i> 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&#x2F;defconstant&#x2F;defparameter&#x2F;). A lot could be done to clean things up and allow faster calculations, but finding all ramadan&#x2F;ash-wednesday correlations in a 5000 (not a typo 10x what TFA does) takes under 1ms on my machine, so <i>shrug</i><p>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.<p>1: <a href="https:&#x2F;&#x2F;github.com&#x2F;EdReingold&#x2F;calendar-code2&#x2F;blob&#x2F;main&#x2F;calendar.l" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;EdReingold&#x2F;calendar-code2&#x2F;blob&#x2F;main&#x2F;calen...</a><p>2: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;jasom&#x2F;1338543679a596449c324eddf716ccb8" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;jasom&#x2F;1338543679a596449c324eddf716cc...</a>