Well, I have to work on a graph that contains the connections between cities, and I have to to depth first search, breadth first search and stuff like that.

I've managed to work on that, but the final problem is to find all the sizes of paths between city "A" the origin and "B", the destination. I was able to work on it with Prolog, but now LISP is giving me headaches :S

Let me paste my code to show you guys how I'm working (:

Btw, the code is in portuguese, so I 'll add some english comments on it (:

This seems a bit old, but it is unanswered so I guess I'll try to point you in some direction. I have not bothered to look at your code, but if you have something that can perform a depth first search or a breadth first search there is not much more to save the path lengths. All you need to do is save what depth you are on. In the DFS this is extremely simple, just pass an extra parameter to the function that marks the length you have searched so far. Then, in your base case store the value. I'll assume this is what is tripping you up probably because you are trying to pass the result up the call stack. The simplest thing to do is to step outside the recursion and just push it onto a special variable. A similar approach can be performed for breadth first search. A common CL idiom is to make a function that provides an external interface and sets up an execution environment and then calls a worker function (typically with the same name but preceded with a %). The interface function can bind a special variable to nil for you and return the modified value as the result.