Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Associative array
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Language support== {{Main|Comparison of programming languages (associative array)}} Associative arrays can be implemented in any programming language as a package and many language systems provide them as part of their standard library. In some languages, they are not only built into the standard system, but have special syntax, often using array-like subscripting. Built-in syntactic support for associative arrays was introduced in 1969 by [[SNOBOL|SNOBOL4]], under the name "table". [[TMG (language)|TMG]] offered tables with string keys and integer values. [[MUMPS]] made multi-dimensional associative arrays, optionally persistent, its key data structure. [[SETL]] supported them as one possible implementation of sets and maps. Most modern scripting languages, starting with [[AWK]] and including [[Rexx]], [[Perl]], [[PHP]], [[Tcl]], [[JavaScript]], [[Maple (software)|Maple]], [[Python (programming language)|Python]], [[Ruby (programming language)|Ruby]], [[Wolfram Language]], [[Go (programming language)|Go]], and [[Lua (programming language)|Lua]], support associative arrays as a primary container type. In many more languages, they are available as library functions without special syntax. In [[Smalltalk]], [[Objective-C]], [[.NET Framework|.NET]],<ref>{{cite web |url=http://msdn.microsoft.com/en-us/library/xfhwa508.aspx |title=Dictionary<TKey, TValue> Class |publisher=MSDN}}</ref> [[Python (programming language)|Python]], [[REALbasic]], [[Swift (programming language)|Swift]], [[Visual Basic for Applications|VBA]] and [[Delphi (programming language)|Delphi]]<ref>{{Cite web|url=http://docwiki.embarcadero.com/Libraries/Tokyo/en/System.Generics.Collections.TDictionary|title=System.Generics.Collections.TDictionary - RAD Studio API Documentation|website=docwiki.embarcadero.com|language=en|access-date=2017-04-18}}</ref> they are called ''dictionaries''; in [[Perl]], [[Ruby (programming language)|Ruby]] and [[Seed7]] they are called ''hashes''; in [[C++]], [[C_Sharp_(programming_language)|C#]], [[Java (programming language)|Java]], [[Go (programming language)|Go]], [[Clojure]], [[Scala (programming language)|Scala]], [[OCaml]], [[Haskell (programming language)|Haskell]] they are called ''maps'' (see [[map (C++)]], [[unordered_map (C++)]], and {{Javadoc:SE|java/util|Map}}); in [[Common Lisp]] and [[Windows PowerShell]], they are called ''hash tables'' (since both typically use this implementation); in [[Maple (software)|Maple]] and Lua, they are called ''tables''. In [[PHP]] and [[R (programming language)|R]], all arrays can be associative, except that the keys are limited to integers and strings. In JavaScript (see also [[JSON]]), all objects behave as associative arrays with string-valued keys, while the Map and WeakMap types take arbitrary objects as keys. In Lua, they are used as the primitive building block for all data structures. In [[Visual FoxPro]], they are called ''Collections''. The [[D (programming language)|D language]] also supports associative arrays.<ref>{{cite web |url=http://dlang.org/hash-map.html|title=Associative Arrays, the D programming language|publisher=Digital Mars}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)