Lisp function help

You have problems, and we're glad to hear them. Explain the problem, what you have tried, and where you got stuck.
Feel free to share a little info on yourself and the course.
Forum rules
Please respect your teacher's guidelines. Homework is a learning tool. If we just post answers, we aren't actually helping. When you post questions, be sure to show what you have tried or what you don't understand.

Lisp function help

Postby g0blu324 » Wed May 16, 2012 5:11 pm

This function works but I also need the condition that the path has to include the library.
(defun depth1 (queue finish)
(cond ((null queue) nil)
((equal finish (caar queue)) (print queue)
(reverse (car queue)))
(t (print queue)
(depth1 (append (expand (car queue)) (cdr queue)) finish))))

My attempt but didn't work:
(defun depth1 (queue finish)
(cond ((null queue) nil)
AND(((equal finish (caar queue))(member 'library queue)) (print queue)
(reverse (car queue)))
(t (print queue)
(depth1 (append (expand (car queue)) (cdr queue)) finish))))
g0blu324
 
Posts: 6
Joined: Sat May 12, 2012 2:16 pm

Return to Homework

Who is online

Users browsing this forum: No registered users and 1 guest