Re: finding all definitions matching a pattern
- To: mathgroup at smc.vnet.net
- Subject: [mg98015] Re: [mg98004] finding all definitions matching a pattern
- From: Fernando Cucchietti <fernando.cucchietti at icfo.es>
- Date: Sat, 28 Mar 2009 05:40:53 -0500 (EST)
- References: <200903271038.FAA25437@smc.vnet.net>
Hi Roman, maybe there is a better way but this seems to work F[0] = 3; F[1] = 7; F[3] = 11; getdefs[func_] := Module[{args}, ({#[[1]] /. f_[func[args__]] -> args , #[[1, 1]]} &) /@DownValues[func]] getdefs[F] {{0, 3}, {1, 7}, {3, 11}} On Mar 27, 2009, at 11:38 AM, Roman wrote: > Dear Mathematica user: > > Assume we have a number of definitions associated with a symbol F, for > example: > F[0] = 3; > F[1] = 7; > F[3] = 11; > > What I need is an automated way to generate the list of definitions, > something like > In[1] := getdefs[F] > Out[1] = {{0,3},{1,7},{3,11}} > > Would you know how to write this function "getdefs"? I am having > trouble extracting any useful information from a call to Definition[F] > since it seems to wrap its output somehow. > > Thanks! > Roman. >
- References:
- finding all definitions matching a pattern
- From: Roman <rschmied@gmail.com>
- finding all definitions matching a pattern