Friday, November 21, 2014

[xneezhkh] List or cons cell

In Lisp, despite its name, the fundamental data structure is not actually the list, but actually the two-element cons cell.

Should this be regarded as a fundamental feature or an artifact of implementation?  In praising the simplicity of Lisp syntax, I usually ignore this artifact, as it introduces one more lexical atom: the period.

It seems anything that can be done with a cons cell can be done with a two element list.  I suppose a cons cell automatically enforces that the length of the list is exactly 2.

No comments :