Re: a list as an option
- To: mathgroup at smc.vnet.net
- Subject: [mg67191] Re: a list as an option
- From: Peter Pein <petsie at dordos.net>
- Date: Sun, 11 Jun 2006 23:07:54 -0400 (EDT)
- References: <e6gd7r$n9j$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Akane Tendo schrieb: > Hello, > > If I have a function f with options like: > Options[f]=[...,{pars->{a,b,c}}] You should get an error message, when trying this (don't know, why you didn't get it). Assign a list of rules to Options[f]: Options[f] = {pars -> {a, b, c}}; > How can I change just one of 'pars' options ('a', 'b' or 'c')? > I tried to change, for example, 'a' to 'd' like this: > SetOptions[f,pars[[1]]->d] SetOptions[f, (Options[f, pars] /. a -> d)[[1]]]; or, if you want to replace the first element of the list, no matter what it is: SetOptions[f, ReplacePart[Options[f, pars], numberone, {1, 2, 1}][[1]]] > But it didn't work. > I also tried to access the option: > Options[f,pars] > And the result is: {} Caused by the syntax error above, there has not been any assignment to Options[f]. > Does anyone know what am I doing wrong or if it's not possible at all to > have a list as an option? > > Thank you!! > >