Search code examples
functioncommon-lispstack-overflowcircular-list

About the function NCONC in Common Lisp


I got a real stack overflow by typing the following codes

(setf l1 (list 1))

(setf l2 (list 2))

(nconc l1 l2)

(nconc l2 l1)

Oops...

Is that a bug?


Solution

  • Not as such. Printing a never-ending list won't ever be a good thing.

    Set *print-circle* to T to see the structure of the list.

    It's no more a bug than the never-ending nature of #1=(foo . #1#)