Re: stack overflow in quine



In article <1135758340.261248.53020@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
rgo <rgo@xxxxxxxxxxxxxxxx> wrote:
> Hello. I cannot understand why this program die with stack overflow:
> #1=(write '#1# :circle t)
> I tried it only on clisp 2.34. Where bug lives: in clisp or in my head?
> I think that before call to write '#1# is evaluated to circular object
> #1=(write '#1# :circle t), and function write must not to evaluate it
> again. But why overflow?

Try:

(progn #1=(write '#1# :circle t) nil)

Keep in mind that the return value of WRITE is the object that was
written, which is a circular list, and *PRINT-CIRCLE* is only bound to
T inside the WRITE call. So when the REPL prints the return value,
it will go on infinitely.

(Unless of course you manually (setf *print-circle* t) beforehand.)

-bcd
--
*** Brian Downing <bdowning at lavos dot net>
.



Relevant Pages

  • stack overflow in quine
    ... I cannot understand why this program die with stack overflow: ... I tried it only on clisp 2.34. ... Where bug lives: in clisp or in my head? ...
    (comp.lang.lisp)
  • Re: CLISP crashing
    ... (like GPS, STRIPS) ... to see if it would give me a stack overflow. ... It is strongly advised to compile clisp with libsigsegv. ...
    (comp.lang.lisp)