As it turns out, arrays aren't actually used that much (except for strings of course) in CL code. Most lists are just a few elements long, and regular lists are perfect for that.
As it turns out, arrays aren't actually used that much (except for strings of course) in CL code. Most lists are just a few elements long, and regular lists are perfect for that.
Arrays, struts, all other things are possible, but the things that make Lisp Lisp mean that you may get a list where repeatedly calling cdr may result in something that is not listp (cons or nil). And that’s weird. It enables some things that are wonderful, but I think the Lisps are practically unique in conflating pairs and list elements.
http://www.lispworks.com/documentation/HyperSpec/Body/c_sequ...
There are some problems with this design. The main motivations for it were:
* basic operations in Lisp are type specific, one wanted to have some generic operations and a generic sequence abstraction over lists and vectors
* the low-level data structures like conses, arrays, tables are not object-oriented and generic
* generic operations in a dynamically typed language are slower, since there is always a runtime dispatch necessary
* to remove runtime dispatch one can use type declarations (which are optional in Common Lisp) or a JIT compiler (which is not used in most implementations, they do AOT compilation)
* the language at the type of this design had no agreed OOP extension - CLOS came some years later -> sequences are non-extensible and don't support adding new sequence types
The design of this was later improved in languages like Dylan: see the Collections of Dylan
http://lispm.de/docs/prefix-dylan/book.annotated/ch12.html
Recently some CL implementations experiment with extensible sequences.
http://www.doc.gold.ac.uk/~mas01cr/papers/ilc2007/sequences-...