2 ms·
A map with integer keys is closer to an array than a list. I'm not sure I follow your arguments - you seem to be talking of "lists" as some sort of string synt
by e12e 7y ago
A map with integer keys is closer to an array than a list.
I'm not sure I follow your arguments - you seem to be talking of "lists" as some sort of string syntax, possibly as some form of abstract syntax - but either way separate from the abstract data structure?
That's not how I read the comment from the misc page - they seem to be talking about the ADT - much like clojure chose to not use lists made from cons pairs?
- aasasd 7y agoNow your distinctions seem foreign to me. Let's look at this structure in Python: ["qwe", 1.1, True, None, [], var1] Is this an array, a linked list or what? Can an integer-indexed map be mapped onto this structure? To me it looks perfectly cromulent for making a Lisp.
- e12e 7y agoSince there isn't any traversal when looking up an element n, I guess the best "short hand" would be to call it an array - it's an array of pointers to objects on the heap. https://www.laurentluce.com/posts/python-list-implementation/ https://www.laurentluce.com/posts/python-list-implementation... As for collections within collections, python allows for that in "lists" (arrays) and "dictionaries" (maps).
- kazinator 7y agoThat's not a structure in Python; that's a piece of program syntax which constructs one. Python is confused between the two, but here we have a telltale detail that tells us which this is: the presence of var1. Can you write a Python function which returns a list that contains var1 as an element, so that it prints exactly as [... ,var1, ...]?