[Date Index] [Thread Index] [Author Index]
Re: pattern test and default value
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.