MathGroup Archive 2008

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

Search the Archive

Re: Inheriting options - is there a way?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90747] Re: Inheriting options - is there a way?
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Tue, 22 Jul 2008 06:38:41 -0400 (EDT)
  • References: <g6446i$dio$1@smc.vnet.net>

Hi,

> Is there a way to define a function so that it will inherit all the options - 
> or a spcified subset of the options -  of some other function - either another user defined function  or a built-in Mathematica function - without explicity having to define all the optoins that are inherited?

The following will make f inherit all options of Plot and the default
values that are set at the time this is executed:

Options[f]=Options[Plot]

Test:

f[OptionsPattern[]]:=OptionValue[Ticks]

f[Ticks->None]

One could try to use SetDelayed (:=) so that the defaults for f's
options reflect the current settings of Plot, but this works only until
one does a SetOptions[f,...]. To make the behaviour more consistent in
that case would require some extra work...

hth,

albert


  • Prev by Date: Re: how to read such kind of list?
  • Next by Date: Text search within a documentation page?
  • Previous by thread: Inheriting options - is there a way?
  • Next by thread: Threading over matrices