home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / usr.bin / lisp / lispnews / text0238.txt < prev    next >
Encoding:
Text File  |  1985-11-10  |  952 b   |  46 lines

  1.     "'Curiouser and curiouser', said Alice".  I dug out the source for
  2. assoc (38.79), and here it is:
  3.  
  4. (def assoc
  5.   (lambda (val alist)
  6.       (do ((al alist (cdr al)))
  7.           ((null al) nil)
  8.           (cond ((null (car al)))
  9.             ((not (dtpr (car al)))
  10.              (error "bad arg to assoc" al))
  11.             ((equal val (caar al)) (return (car al)))))))
  12.  
  13. So nothing particularly screwy is going on here.  However, when I do the
  14. traces (after setting up stuff the way you did), I get:
  15. => (assoc 'b 'l)
  16. 1 <Enter> assoc (b l)
  17. 1 <EXIT>  assoc  (b 2)
  18. (b 2)
  19. => (assoc 'b ''l)
  20. 1 <Enter> assoc (b 'l)
  21. Error: bad arg to assoc (quote l) 
  22. Form: (assoc 'b ''l)
  23. {1} bar
  24. foo
  25. {1} (assoc 'b 'foo)
  26. |2 <Enter> assoc (b foo)
  27. |2 <EXIT>  assoc  (b 2)
  28. (b 2)
  29. {1} foo
  30. l
  31. {1} bar
  32. foo
  33. {1} (assoc 'b bar)
  34. |2 <Enter> assoc (b foo)
  35. |2 <EXIT>  assoc  (b 2)
  36. (b 2)
  37. {1} (assoc 'b ''l)
  38. |2 <Enter> assoc (b 'l)
  39. Error: bad arg to assoc (quote l) 
  40. Form: (assoc 'b ''l)
  41. {2}
  42.  
  43. Which is certainly *very* odd...
  44.  
  45.  
  46.