Re: List of patterns for which a function is defined?
- To: mathgroup at smc.vnet.net
- Subject: [mg24409] Re: List of patterns for which a function is defined?
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 18 Jul 2000 00:58:08 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <8kjdh1$du2@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, ListOfPatternsDefined[a_Symbol] := First /@ DownValues[a] /. a[arg_] :> arg /. Verbatim[HoldPattern][val_] :> val will do it Regards Jens Roger Wilson wrote: > > I have a function b which I define explicitly for a set of input values. > > a[1]=4; a[2]=5; a["cat"]="sam"; > > If I type ??a I get the usual listing of the definition of a but how do I > get a list of the values or patterns for which a is defined? > > ListOfPatternsDefined[a] > {1,2,"cat"} > > In python this would be a.keys() but in Mathematica I'm stuck? > > Any ideas? >