Before Mathematica 10.0, when there was no Association, the suggested way of using datastructures map, was to abus arguments of undefined symbols:
foo["a"] = 1 foo["b"] = 1 I would like to explore the keys of the map foo. Defined symbols can be explored by Names command. However, it does not work. I have tried:
Names["foo*"] Names["foo[*]"] Names["foo[\"*\"]"] Names["foo[a]"] which gives:
{"foo"} {} {} {} The manual is also clearly wrong:
Names["string"] gives the same list of names as ?string.
While ?"foo" and ?foo lists all my elements, Names["foo"] only returns {"foo"}, instead of {"foo[\"a\"]","foo[\"b\"]"} or something similar.
What is the proper way of extracting all the members of the map foo?
Why do I ask? From time to time I still feel it nice to use the syntax to give my variable names some structure and later go through them using Map for example, if I only had possibility to get the list of keys.
Edit: As I wrote in the very beginning, I am aware of Association. Abusing arguments of symbols is, however, way more flexible. For example, for some arguments, a function could be called instead of a value from a map. See for example see memoization.
(Using Mathematica 11.3)

DownValues[foo]provide what you want? OrDownValues[foo][[All, 1, 1, 1]]? $\endgroup$Association$\endgroup$