[cl-kanren-trs-cvs] r5 - cl-kanren-trs

mswank at common-lisp.net mswank at common-lisp.net
Fri Feb 24 01:12:29 UTC 2012


Author: mswank
Date: Thu Feb 23 17:12:29 2012
New Revision: 5

Log:
Update defconst to work with recent sbcl.

Modified:
   cl-kanren-trs/kanren.lisp

Modified: cl-kanren-trs/kanren.lisp
==============================================================================
--- cl-kanren-trs/kanren.lisp	Thu Jun 19 23:15:28 2008	(r4)
+++ cl-kanren-trs/kanren.lisp	Thu Feb 23 17:12:29 2012	(r5)
@@ -29,11 +29,10 @@
 (common-lisp:in-package :kanren-trs)
 
 (defmacro defconst (name value &optional (documentation nil docp))
-  `(eval-when (:execute :load-toplevel :compile-toplevel)
-     (unless (boundp ',name)
-       ,(if docp
-            `(defconstant ,name ,value ,documentation)
-            `(defconstant ,name ,value)))))
+  (let ((global (intern (format nil "%%~A" (symbol-name name)))))
+    `(progn
+       (defvar ,global ,value ,@(and docp `(,documentation)))
+       (define-symbol-macro ,name (load-time-value ,global t)))))
 
 ;;;A -> stream
 (defmacro unit (a) a)




More information about the cl-kanren-trs-cvs mailing list