Patterns
- To: mathgroup@smc.vnet.net
- Subject: [mg11462] Patterns
- From: mabi@solidmr.kun.nl (Marlies Brinksma)
- Date: Thu, 12 Mar 1998 01:34:19 -0500
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