I want to use a Structure like HashTable. Is there similar structure in Wolfram Mathematica?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Update: Mathematica version 10 introduced the
Associationdata structure (tutorial).There are a number of possibilities. The easiest possibility, which works well if you don’t need to add or delete keys from your table, or change their associated values, is to construct a list of rules with the key on the left-hand side and the value on the right-hand side, and use
Dispatchon it.If you do need to change the entries in your table, you can use the
DownValuesof a symbol as a hash table. This will support all the operations one commonly uses with hash tables. Here’s the most straightforward way of doing that: