Re: Warning from Piecewise
- To: mathgroup at smc.vnet.net
- Subject: [mg61559] Re: Warning from Piecewise
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Sat, 22 Oct 2005 00:36:11 -0400 (EDT)
- References: <dja298$fhh$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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