Tag List Protected error
- To: mathgroup at smc.vnet.net
- Subject: [mg113672] Tag List Protected error
- From: niobe <ben.carbery at gmail.com>
- Date: Sun, 7 Nov 2010 05:10:50 -0500 (EST)
Hi, I am trying to use ReplacePart in a function definition. The function works using =, but not := newX= ReplacePart[x,{y[[1, 1]], y[[2, 1]]} -> x[[y[[1, 1]], y[[2, 1]]]] - y[[2, 2]]] .. works update[x, y] := ReplacePart[ x, {y[[1, 1]], y[[2, 1]]} -> x[[y[[1, 1]], y[[2, 1]]]] - y[[2, 2]] ] .. SetDelayed::write: Tag List in <snip> is Protected. x and y are just integer lists. The problem seems to be Mathematica trying to replace the head (List) of the rule in ReplacePart... even though this is just correct syntax for replace part. I tried using RuleDelayed but no change. Many functions use rules in their syntax so this must be a general issue I haven't come across yet. cheers B