[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug in assoc



	"'Curiouser and curiouser', said Alice".  I dug out the source for
assoc (38.79), and here it is:

(def assoc
  (lambda (val alist)
	  (do ((al alist (cdr al)))
	      ((null al) nil)
	      (cond ((null (car al)))
		    ((not (dtpr (car al)))
		     (error "bad arg to assoc" al))
		    ((equal val (caar al)) (return (car al)))))))

So nothing particularly screwy is going on here.  However, when I do the
traces (after setting up stuff the way you did), I get:
=> (assoc 'b 'l)
1 <Enter> assoc (b l)
1 <EXIT>  assoc  (b 2)
(b 2)
=> (assoc 'b ''l)
1 <Enter> assoc (b 'l)
Error: bad arg to assoc (quote l) 
Form: (assoc 'b ''l)
{1} bar
foo
{1} (assoc 'b 'foo)
|2 <Enter> assoc (b foo)
|2 <EXIT>  assoc  (b 2)
(b 2)
{1} foo
l
{1} bar
foo
{1} (assoc 'b bar)
|2 <Enter> assoc (b foo)
|2 <EXIT>  assoc  (b 2)
(b 2)
{1} (assoc 'b ''l)
|2 <Enter> assoc (b 'l)
Error: bad arg to assoc (quote l) 
Form: (assoc 'b ''l)
{2}

Which is certainly *very* odd...