MathGroup Archive 2002

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

Search the Archive

Re: arguments/realtime3d


On Wed, 9 Jan 2002, daniel wrote:

> Is there a way to obtain the number of arguments with wich
> the function was called as in
> f[x___?OptionQ]:=Module ...?

In principle, it should be possible to invoke Length[] on a list wrapped
around the argument sequence.


In[1]:= g[x___?OptionQ] := Print["Number of arguments: ", Length[{x}]]

In[2]:= g[a -> b, c -> d, e -> f]
Number of arguments: 3

Why would one create a function with only optional arguments in the first
place?  Do you intend a Null argument to be valid input as well?

> I  would like to check if x contains only valid options of f (defined with
> Options[f,a->1])

See the function FilterOptions[], which is defined in the Standard Package
Utilities`FilterOptions`.  For more information, paste the following
expression in a notebook and evaluate it.

FrontEndExecute[
  FrontEnd`HelpBrowserLookup["AddOns", "Utilities`FilterOptions`"]
]

> second question: is there a way to have RealTime3D under Linux (Matematica
> 4.0)

No, RealTime3D wasn't introduced on X Window front ends until the release
of Mathematica 4.1.

-- 
P.J. Hinton
User Interface Programmer                         paulh at wolfram.com
Wolfram Research, Inc.
Disclaimer: Opinions expressed herein are those of the author alone.



  • Prev by Date: Re: Re: more elements in a list
  • Next by Date: RE: Holding Arguments in a Second Argument List
  • Previous by thread: Re: arguments/realtime3d
  • Next by thread: Re: arguments/realtime3d