From: Steve Haflich

Subject: Re: strong connected Graph

Date: 2003-1-22 19:11

   From: feilong <coli.uni-sb.de at feilong>
   
   I want to define a strong connected graph with lisp:
   (let ((graph '(a (b nil . nil) c)))
          (setf (second (second graph)) (second graph))
         (setf (rest (last (second graph))) (rest (rest graph)))
          graph)
   but intepreter displays error messages
    *** - Lisp stack overflow. RESET
   Why is this graph false?
   By the way,how can I correct build a strong-connected graph with lisp 
   and how can I such each atom in this graph?  

There is a subtle violiation here that has nothing to do with your
problem.  CL does not allow modifying any constant, such as the quoted
list in the first line of your example.  Your should instead write
soemthing like:

   (let ((graph (list 'a (list 'b nil) 'c)))
     ...)

which guarantees a freshly consed tree that you may safely modify.

But that is not important to your immediate question.  There is
nothing wrong with your graph, except that the top level is trying to
print your graph, which has nothing wrong with it, except that the top
level is trying to print your graph, which has nothing wrong with it,
except that the top level is trying to print your graph, which has
nothing wrong with it, except that the top level is trying to print
your graph, which has nothing wrong with it, except that the top level
is trying to print your graph, which has nothing wrong with it, except
that the top level is trying to print your graph ...

See the special variable *print-circle*.