Re: Options[] creation
- To: mathgroup at smc.vnet.net
- Subject: [mg39255] Re: [mg39217] Options[] creation
- From: Omega Consulting <omega_consulting at yahoo.com>
- Date: Thu, 6 Feb 2003 03:07:47 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
If the only shapes are Circle and Ellipse, then I would merge the two options into a single option. Diameter->d gives a Circle. Diameter->{dshort, dlong} gives an ellipse. Another technique would be to make the diameter(s) a parameter of the shape. Shape->Circle[d] and Shape->Ellipse[dshort, dlong] At 01:21 AM 2/4/2003, Kyriakos Chourdakis wrote: >Dear all, > >Suppose I create a function f[x_,opts___] >with options >Shape in {Circle, Ellipsis} and Diameter in R+, DiameterLong in R+, >DiameterShort in R+ >Say that the defaults are >Options[x]={Shape->Circle, Diameter->1.} > >The option Diameter makes sence only when Shape->Circle, and >The options DiameterShort/Long make sense only when Shape->Ellipsis > >Is there a quick way to tell Mathematica to warn if these conditions are >not satisfied? I could write a series of boolean tests, but I was wondering >if there is a more elegant way. > >Best, > >Kyriakos > > > >_____+*"*+____+*"*+___+*"*+__+*"*+_ > >Kyriakos Chourdakis >Lecturer in Financial Economics > >URL: http://www.qmw.ac.uk/~te9001 >tel: (++44) (+20) 7882 5086 >Dept of Economics >University of London, QM >London E1 4NS >U.K. -------------------------------------------------------------- Omega Consulting "The final answer to your Mathematica needs" http://omegaconsultinggroup.com