[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug in assoc
- To: jmiller%ct.csnet@csnet-relay.ARPA, franz-friends%ucbkim@Berkeley
- Subject: Re: bug in assoc
- From: Rick McGeer (on an h19-u) <mcgeer%ucbkim@Berkeley>
- Date: Tue, 14 Aug 84 18:53:28 GMT
- In-reply-to: Your message of 13 Aug 1984 20:46:42-PST
- Original-date: Tue, 14 Aug 84 11:53:28 pdt
- Phone: (415) 236-8262
"'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...