Hello,
Clearly SetDelayed does some partial evaluation of the left hand side,
as the following example shows:
f[Print["foo"]] := 1
foo
Unfortunately, Piecewise reports an error if the input is not of the
right format, rather than leaving it unevaluated. One approach is to write:
Comm[p_[A : {{_, _} ..}], p_[B : {{_, _} ..}]] :=
Comm[Testy[A], Testy2[B]] /; p === Piecewise
However, it may be easier to work with objects of the form
myPiecewise[...] - which Mathematica will ignore - and then use
something like:
expression /.myPiecewise->Piecewise
when you want to let Mathematica manipulate these constructs.
David Bailey
http://www.dbaileyconsultancy.co.uk