MathGroup Archive 1997

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

Search the Archive

Re: pattern test and default value

  • To: mathgroup at smc.vnet.net
  • Subject: [mg6003] Re: [mg5967] pattern test and default value
  • From: seanross at worldnet.att.net
  • Date: Sat, 8 Feb 1997 22:38:42 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Marlies wrote:
> 
> Hi,
> 
> It is possible to do the following:
> 
> x_h:v (an expression with head h and default value v)
> 
> Can anyone tell me whether it is possible to have a pattern test like
> _?NumberQ  AND have a certain default value?
> 
> Regards,
> 
> Marlies Brinksma


Try 
x_:v/;NumberQ[x].  

I routinely use this format for things like testing for square matrices 
of a certain length and input parameter management.


  • Prev by Date: Re: Integration
  • Next by Date: Fwd: Why doesn't this simplify further?
  • Previous by thread: pattern test and default value
  • Next by thread: Re: pattern test and default value