3 ms·
People prefer arrays to singly-linked lists. Python gets it (but doesn't get many other things Lisp gets)
by critic 18y ago
People prefer arrays to singly-linked lists. Python gets it (but doesn't get many other things Lisp gets)
- jimbokun 18y agoOne of the advances of Clojure over other Lisps, is that vectors and maps are just as well supported as lists. They have their own reader syntax (using [] and {} as delimiters, respectively), and all three implement the Collection interface, which means a lot of Clojure functions work equally well on all three. There is also syntax for destructuring. And the use of vectors in places where destructuring is possible (like function arguments and let bindings) makes it easier to identify code structure at a glance (a complaint against other Lisps).
- anamax 18y agoCommon lisp sequence functions work on lists, vectors (including those specialized for bits, bytes, etc), and strings.
- GeoJawDguJin 18y agoSome of them do. There are lots of redundant functions in CL, for reasons of backwards compatibility.
- anamax 18y agoAll of the sequence functions and special forms work on all of the sequence types. The "redundancy" is that there are also functions/forms that work on specific sequence types. It would be surprising if there weren't because if two data types have exactly the same set of operations, one of them may be unnecessary.
- pivo 18y agoThat's a strange statement. Lists and arrays are different data structures for different purposes. It's like saying that people prefer btrees to structures. Lisp has arrays as well, so if people want to use them they can.