On Thursday, 9 July 2015 at 20:57:54 UTC, Tofu Ninja wrote:
On Thursday, 9 July 2015 at 19:19:42 UTC, Walter Bright wrote:
On 7/9/2015 12:56 AM, deadalnix wrote:
Several of which actually use linked list for list and
probably shouldn't
provide random access.
Yes. Consider:
for (int i = 0; i < list.length; ++i)
sum += list[i];
If indexing was allowed on a list, this would seem like
perfectly reasonable code.
In many languages that is perfectly reasonable because list
does not equal linked list. Its almost as if a list is an
abstract concept and does not mean any one definite data
structure, hmmm who wuda thunk that...
It's definitely true that the term list does not denote a
particular data structure in computer science, so I disagree with
Walter's reticence to use the term list with AliasList, but it's
also true that some languages and libraries have stupidly put
indexing on a linked list, which is what deadalnix was
complaining about.
- Jonathan M Davis