MathGroup Archive 2002

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

Search the Archive

Re: arguments/realtime3d


In a message dated 1/9/02 4:13:08 AM, 6.6e-34 at gmx.de writes:

>Is there a way to obtain the number of arguments with wich
>the function was called as in
>f[x___?OptionQ]:=Module ...?
>I  would like to check if x contains only valid options of f (defined with
>Options[f,a->1])
>

Use the standard add-on package Utilities`FilterOptions`


To count the options, before or after filtering, use Length[{}]
 

Clear[f]
;

f[x_, opt___?OptionQ] := Length[{opt}];

f[x]

0

f[x, a->b, c->d]

2


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: Re: more elements in a list
  • Next by Date: RE: more elements in a list
  • Previous by thread: arguments/realtime3d
  • Next by thread: Re: arguments/realtime3d