MathGroup Archive 1998

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

Search the Archive

Patterns



Hello,

To illustrate the problem I encountered, lets say I defined the
following function:

condition[arg1_,arg2_]=True;

f[arg1_,arg2_]/;condition[arg1,arg2] := CheckArg[arg1,arg2]

CheckArg[arg1_,arg2_]:=Module[{},
(* If the arguments are correct set the condition to false and return
f[arg1,arg2] if not return $Failed*)
]

While defining transformation rules, patterns like arg1_ are entered as 
arguments of the function f. However they are not valid arguments in
the  current implementation.
For example, arg1 should be a positive integer.

Typically the function HoldPattern[] can be used. But I was thinking
that this could possibly be prevented.

I have some vage ideas to do this, but in one way of another they don't
satisfy me.
Can anyone think of a solution, or should I just use the HoldPattern[]
function, because this is the most natural way to solve this?

I'm looking forward to your comments!

Marlies Brinksma



  • Prev by Date: I can not run kernel
  • Next by Date: Re: Defining a Function??
  • Prev by thread: I can not run kernel
  • Next by thread: Extracting polynomial coefficients?