MathGroup Archive 2009

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

Search the Archive

Re: Passing function arguments as lists of replacement rules

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104675] Re: Passing function arguments as lists of replacement rules
  • From: Yves Klett <yves.klett at googlemail.com>
  • Date: Sat, 7 Nov 2009 06:43:08 -0500 (EST)
  • References: <hd0t9j$82h$1@smc.vnet.net>

Hi,

affirmative. A good and sometimes very handy approach for complex and/or
moving targets (if performance is not an issue, because of the
replacement overhead). Very much related to the general options mechanism.

Regards,
Yves

dnquark schrieb:
> I wish to (a) avoid having to pass a dozen parameters to a function
> and have to deal with remembering which goes where and (b) retain the
> flexibility in terms of adding new parameters.  It seems that a good
> solution would be to pass my parameters as a structure with named
> fields (this is how I do it in another system).  In Mathematica, I came up
> with something like this:
> 
> foo[paramList_] := Module[{a,b,c},
> {a,b,c} = {"a","b","c"}/.paramList;
> {a,b,c}
> ]
> sample usage: e.g.  foo[{"a"->1,"b"->2}]
> 
> My question to the group: is this a good solution?  Are there better
> ways to achieve my goals?..
> Thanks,
> --Leo
> 


  • Prev by Date: Re: SphericalPlot3D ColorFunction problem
  • Next by Date: Re: Passing function arguments as lists of replacement rules
  • Previous by thread: Passing function arguments as lists of replacement rules
  • Next by thread: Re: Passing function arguments as lists of replacement rules