
The flaw in Lisp - breck
http://breckyunits.com/the-flaw-in-lisp.html
======
daly
It is not clear but it appears you have discovered that it is possible to
create circular lists, that is, a list that contains itself.

This isn't a flaw, it is a feature. Using circular lists it is possible to
create "infinite lists". These are useful in many ways.

(setq a (quote #1=(5 . #1#)))

(fifth a)

(seventh a)

This will give you an "infinite stream" of 5

Similarly graph structures can be made so each node in the graph contains the
whole graph.

Read Structure and Interpretation of Computer Programs from MIT Press.

~~~
breck
Thanks for the feedback Daly. I have read SICP.

What I've discovered is that syntax matters. That if you fix Lisp's syntax, it
becomes much easier to program.

------
timonoko
TL;DR:?

In the meantime:

$ clisp

[1]> (setq a '(1 2))

(1 2)

[2]> (progn (nconc a a) nil)

NIL

[3]> (nth 2 a)

1

[4]> (nth 101 a)

2

[5]> (length a)

 __* - LENGTH: A proper list must not be circular: #1=(1 2 . #1#)

