Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: arguments/realtime3d

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32302] Re: arguments/realtime3d
  • From: "daniel" <6.6e-34 at gmx.de>
  • Date: Sat, 12 Jan 2002 05:18:12 -0500 (EST)
  • Organization: Technical University Berlin, Germany
  • References: <a1mbn7$2t4$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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?