Re: Tag List Protected error
- To: mathgroup at smc.vnet.net
- Subject: [mg113740] Re: Tag List Protected error
- From: Raffy <adraffy at gmail.com>
- Date: Wed, 10 Nov 2010 06:27:39 -0500 (EST)
- References: <ib5u05$c0j$1@smc.vnet.net> <ib8csq$2fn$1@smc.vnet.net> <ibb27h$56a$1@smc.vnet.net>
On Nov 9, 12:54 am, niobe <ben.carb... at gmail.com> wrote: > Apologies, that was just a typo when copying to email and my function > arguments are correct > > 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. > > Has no-one else encountered this issue? Could you provide a x, y pair that reproduce this error? I would avoid using ReplacePart. If I understand your example correctly... y is a ragged array: {{row}, {col0, col1}} And you're performing the following operation: x[[row, col0]] - x[[row, col1]] update2[x_, {{row_}, {col0_, col1_}}] := Module[{temp = x}, temp[[row, col0]] -= temp[[row, col1]]; temp ];