The Naming of List Things in Computer Languages

By Xah Lee. Date: . Last updated: .

list means quite a lot different things in different langs, but often, when in argument in a particular lang community, the people ignore, deny, any other meanings, insists any other meaning is wrong or troll. This was the case with many common lisp regulars in comp.lang.lisp.

a listy thing that's fixed in length and allow fast random access is most often called “array”, of C's array.

listy thing that's chained as in lisp “cons”, is often called “linked list” or simply “list”. Best example is lisp's list (list 1 2 3), which is really (cons 1 (cons 2 (cons 3 nil))) (Cons Cells - GNU Emacs Lisp Reference Manual)

lisp's “vector” datatype (vector 1 2 3) is array. 〔➤see Emacs Lisp: List vs Vector〕 (Sequences Arrays Vectors - GNU Emacs Lisp Reference Manual)

Mathematica's list List[] is array.

perl's “array” @a = (1,2,3); and python's “list” a = [1,2,3], and ruby's array, are … not sure there's a specific name, but perhaps smart array. That is, array that automatically grows without being slow (the language adds hidden empty elements exponentially). Specifically, it's not lisp's linked list. 〔➤see Python: List Basics〕 〔➤see Perl: List/Array Tutorial

what perl calls a “list”, is actually only a syntactic thing. Once it's set to a var, perl calls it array. It also has automatic growth feature. 〔➤see Perl: Difference Between List and Array

PHP's list is a mix of array and hashmap. It's really a hashmap with magic. But when keys are not used/set, it auto default to numbers, as array. PHP doc says “An array in PHP is actually an ordered map.” Arrays 〔➤see PHP: Array Basics

JavaScript's array is really a hashmap, what it calls “object”, with magic. The index of js's array is actually just the name of keys that happens to be positive integer…. 〔➤see JavaScript: Understanding JavaScript Array

also, the name for the whole family of listy thing is called by different names in different lang.

lisp calls it “sequence” type. (but not including “hash table”, but includes {list, associative list, vector, string, …})

          _____________________________________________
         |                                             |
         |          Sequence                           |
         |  ______   ________________________________  |
         | |      | |                                | |
         | | List | |             Array              | |
         | |      | |    ________       ________     | |
         | |______| |   |        |     |        |    | |
         |          |   | Vector |     | String |    | |
         |          |   |________|     |________|    | |
         |          |  ____________   _____________  | |
         |          | |            | |             | | |
         |          | | Char-table | | Bool-vector | | |
         |          | |____________| |_____________| | |
         |          |________________________________| |
         |_____________________________________________|
emacs lisp's sequence datatype.

Java calls it “collection” for list/array/set things Collection (Java Platform SE 8 ) and calls it “map” for list of pairs things. Map (Java Platform SE 8 )

Python wants to call it “sequence”, and if counting {hash, map, sets} it's called “container” type. (4. Built-in Types — Python v3.3.3 documentation #sequence-types-list-tuple-range)

“hash table” is known as “map” in java Map (Java Platform SE 8 ) , “dictionary” in python, “object” in JavaScript 〔➤see What's Object in JavaScript?〕 , “array” in PHP Arrays . But in {perl, ruby, lisp}, it's just called any of {hash, hash map, hash table}.

〔➤see Meaning of Object in Computer Languages