Which languages support non-scalar associative array keys?
I want to make an array like:
[key1,key2,key3,key4]=>[object]
I guess I'd be satisfied if the multiple keys had to each be scalars, although bonus points if they can be any data type.
Which languages support non-scalar associative array keys?
I want to make an array like:
[key1,key2,key3,key4]=>[object]
I guess I'd be satisfied if the multiple keys had to each be scalars, although bonus points if they can be any data type.
What you are looking for is called hash tables (or hashmaps). You can implement them in most languages. Some languages already have support for hash tables like c++, java, lisp, python ...
Here are some references for some languages:
https://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html in java
Also, from personal experience I found out that they are extreamly easy to work in lisp.
I don't know of any that support them directly. Perl does allow multiple scalar keys in its associative arrays via $var{$key1, $key2}
but all that does is automatically concatenate the two values into a larger one and is equivalent to $var{"$key1$;$key2"}
. $;
is "\034" so there will be unexpected collisions if your key strings contain that value.
The same trick could be applied in any language by serializing the more complex data type into a single string.