From: William Harold Newman <william.newman@ai...> - 2001-06-08 16:44:43
On Fri, Jun 08, 2001 at 12:35:39AM +0100, Daniel Barlow wrote:
> Not on _any_ defvar, but the example he gives is real. The problem is
> in circular-list-p, and therefore My Fault, too. Sorry. Patch attached. I
> haven't rebuilt using it (doing that now), but I have tested it from the repl
OK, thank you, the patch works for me and is in sbcl-0.6.12.27 now.
I modified your patched code slightly: my version looks like
(defun circular-list-p (x)
(and (listp x)
(labels ((safe-cddr (x) (if (listp (cdr x)) (cddr x))))
(do ((y x (safe-cddr y))
(started-p nil t)
(z x (cdr z)))
((not (and (consp z) (consp y))) nil) ; <-WHN
(when (and started-p (eq y z))
where the line marked with "<-WHN" is modified from your code
((not (and z y (consp z) (consp y))) nil)
I thought the shorter version was slightly easier to read. It will
probably compile to slightly different code (ordering low-level type
tests differently) but I didn't think that would matter much.
William Harold Newman <william.newman@...>
"I have a calligraphic button that says 'Code as if whoever maintains
your code is a violent psychopath who knows where you live.' Great
advice. Anyone know the original source?"
-- Tom Swiss in http://slashdot.org/books/99/09/16/1333202.shtml
PGP key fingerprint 85 CE 1C BA 79 8D 51 8C B9 25 FB EE E0 C3 E5 7C
Get latest updates about Open Source Projects, Conferences and News.