Circular lists in Common Lisp
There are two ways to create a circular list in Common Lisp. The first method is to use the sharp-equal notation. Here we assign a label to a cons cell, so that we can refer to it later:
> '#1='(1 2 3 . #1#)
(1 2 3 1 2 3 1 2 3 1 ...)
The other method is to nconc a list to itself:
> (setq a '(1 2 3))
(1 2 3)
> (nconc a a)
(1 2 3 1 2 3 1 2 3 1 ...)