MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Obtaining information about function definitions


f["abc"][x_] := 1;
f["def"][x_] := 2;
f["ghi"][x_] := 3;

Cases[SubValues[f], f[str_][_] :> str, 3]

{"abc", "def", "ghi"}


Bob Hanlon

---- ntg <ntgladd at gmail.com> wrote: 

=============
Suppose I have defined a set of functions associated with symbol f and
indexed by strings, for example

f["abc"][x_] := 1;
f["def"][x_] := 2;
f["ghi"][x_] := 3;
...

I would like to write a program that defines a new set of functions
associated with g and indexed by the same strings.

How can I obtain a list of all the strings that have been used as
indexes of f? Both Information[f] and Definition[f] result in output
that "shows" me the information I seek. But I can't access and
manipulate that information. There must be a way to do this. Can
anyone help?

Thanks,
Tom



  • Prev by Date: Re: NMinimize::nrnum:
  • Next by Date: Re: TextRecognize tabular data
  • Previous by thread: Re: Obtaining information about function definitions
  • Next by thread: Maximum likelihood and experimental data