MathGroup Archive 2002

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

Search the Archive

Re: arguments/realtime3d


Hello,
> 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?
>
Yes, I want the function to accept a null argument.
The function is a constructor for a simulation starting set, it returns a
list of system parameters.
My concern about Length[x] was what occurs if f is called without an
argument and x has been defined
elsewhere. Is this safe even for older versions of Mathematica?


Thanks for your answer

Daniel




  • Prev by Date: A MathLink question
  • Next by Date: Experimental data analyst
  • Previous by thread: Re: arguments/realtime3d
  • Next by thread: How to keep cells closed?