The Naming of List Things in Computer Languages

, ,

xah's rumination extempore❕ episode №20131128T131526

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 meaning, insisting 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 access is most often called “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) (Cons Cells - GNU Emacs Lisp Reference Manual)

lisp's “vector” datatype (vector 1 2 3) is array. 〔➤ Emacs Lisp Tutorial: List & 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] are … not sure what they called technically, but perhaps a smart array. That is, array with auto expansion feature without being slow. Specifically, it's not lisp's linked list. I believe ruby's is similar here. In ruby, list is called array. 〔➤ Python: List Tutorial and List Methods〕 〔➤ Perl: List/Array Tutorial

what perl calls a “list”, is actually only a syntactic thing. Once it's set to a var, it's called array. 〔➤ Perl: What's the Difference Between List & Array

PHP's list is a mix of array & 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.” (http://us.php.net/manual/en/language.types.array.php) 〔➤ 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…. 〔➤ What's Object in JavaScript?〕 〔➤ JavaScript Array Methods

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 {associative list, vector, …})

Java calls it “collectible”.

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)

i also heard “aggregate”, but not sure which lang uses that. Where?

“hash table” is known as “map” in java, “dictionary” in python, “property” in javascript, “array” in PHP. But in {perl, ruby, lisp}, it's just called any of {hash, hash map, hash table}.

〔➤ Meaning of Object in Computer Languages

blog comments powered by Disqus