Re: Previous variable affects "/."
- To: mathgroup@smc.vnet.net
- Subject: [mg11313] Re: [mg11236] Previous variable affects "/."
- From: Bob Hanlon <BobHanlon@aol.com>
- Date: Wed, 4 Mar 1998 01:40:16 -0500
You need to use RuleDelayed: a = {{1, 2}, {3, 4}, {5, 6}, {7, 8}}; a /. {x_, y_} -> {x} {{7},{7},{7},{7}} x = 7; a /. {x_, y_} -> {x} a /. {x_, y_} :> {x} {{7},{7},{7},{7}} {{1},{3},{5},{7}} ?Rule "lhs -> rhs represents a rule that transforms lhs to rhs." ?RuleDelayed "lhs :> rhs represents a rule that transforms lhs to rhs, evaluating rhs only \ when the rule is used." Bob Hanlon