posted 1 year ago
Welcome to the Ranch, Saleh!
Unfortunately, LISP isn't very standardized, so it would help if you'd tell us what dialect of LISP your are running on and what platform. I have Common Lisp (clisp) for Linux, Guile (Scheme) and eLisp (Emacs internal LISP) just that I know of. Oh yes, and whatever my Festival speech synthesizer uses!
I tried your sample code out on clisp, and I got this:
-----------------------------------------------------------------------------
[1]> (defparameter *graph* '((A B C)
(B A C D)
(C A B D)
(D B C)))
(defun find-path (start end)
(if (equal start end)
(list start)
(loop for node in (cadr (assoc start *graph*))
when (find-path node end)
return (cons start it))))
(find-path 'A 'D)
*GRAPH*
[2]>
FIND-PATH
[3]>
*** - ENDP: A proper list must not end with B
The following restarts are available:
ABORT :R1 Abort main loop
----------------------------------------------------------
I haven't tried to dissect this stuff in detail, but my suspicion is that probably you aren't quoting everything you need to quote.
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.