Re: conditionnal rule
- To: mathgroup at smc.vnet.net
- Subject: [mg51532] Re: [mg51499] conditionnal rule
- From: Tomas Garza <tgarza01 at prodigy.net.mx>
- Date: Thu, 21 Oct 2004 22:20:54 -0400 (EDT)
- References: <200410200521.BAA08454@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Perhaps you could supply us with more detail about the elements of myList (numbers?, possibly lists of numbers?, elements whatsoever?). Now, in any case your criterion for testing is wrong: a list can have length one and still be a list. I.e., {a} != a. Tomas Garza Mexico City ----- Original Message ----- From: "Wishmaster7" <darkness_wizard at hotmail.com> To: mathgroup at smc.vnet.net Subject: [mg51532] [mg51499] conditionnal rule > hi all !! > > I want to apply a rule under a certain condition. here is the example : > > myList = {{a, b}, {c, d}}; > > myList //. {a,x_}->{a,d} > > apply this rule if Length[x]===1 (this means that x can not be a list) > > I tried something like : > > myList //. {a_,x_}->{c,d}/;Length[x]===1 > > or > > myList //. {a_,x_?Length[x]===1}->{c,d}/ > > but it does not work. > > can someone help me ? > >
- References:
- conditionnal rule
- From: darkness_wizard@hotmail.com (Wishmaster7)
- conditionnal rule