MathGroup Archive 1997

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

Search the Archive

Re: Mathematica question (another one)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg5751] Re: [mg5737] Mathematica question (another one)
  • From: Allan Hayes <hay at haystack.demon.co.uk>
  • Date: Tue, 14 Jan 1997 10:42:29 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Gadi Oron <oron at tremois.pmmh.espci.fr>
[mg5737] Mathematica question (another one)
writes

>>>>>>>>>>>
>How should i define a function that has an optional argument with  
>certain form, let me explain:
>Suppose that a function has to receive an OPTIONAL list of rules
>that takes the deafault value {}.
>
>I've tried :
>
>func[sub:{___Rule}:{}]:=...
>
>But it does not work.

Gadi:

f[Optional[sub:{___Rule} ,{}]]:= A[sub]

is OK on V3.0 but not on V2.2.

However

f[sub:{___Rule}:{}]:= A[sub]

is not accepted as proper input in V3.0 and, does not work in V2.2.

You might like to try  ___?OptionQ instead of ___Rule.

?OptionQ
OptionQ[e] returns True if e can be considered an option or list of
   options, and False otherwise.

Allan Hayes
hay at haystack.demon.co.uk
http://haystack.demon.co.uk



  • Prev by Date: M3 TeXSave
  • Next by Date: Printing to HP LaserJet4
  • Previous by thread: Mathematica question (another one)
  • Next by thread: Question: Purchase of Mathematica