• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Lisp

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I'm trying to test the find-path function by calling it,



I'm getting this error

Error: Illegal argument to endp: A
[condition type: TYPE-ERROR]
 
Saloon Keeper
Posts: 28321
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Saleh Fakka
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you

Im using ACL
 
Opportunity is missed by most people because it is dressed in overalls and looks like work - Edison. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic