MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Tag List Protected error

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113693] Re: Tag List Protected error
  • From: Raffy <adraffy at gmail.com>
  • Date: Mon, 8 Nov 2010 03:37:53 -0500 (EST)
  • References: <ib5u05$c0j$1@smc.vnet.net>

On Nov 7, 2:11 am, niobe <ben.carb... at gmail.com> wrote:
> 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

The two arguments in the definition of update are not patterns:
update[x, y] := ...

Try:  update[x_, y_] := ...


  • Prev by Date: Anyone ever used the Mac app called ForeverSave with Mathematica?
  • Next by Date: Re: Numerical simulation
  • Previous by thread: Tag List Protected error
  • Next by thread: Re: Tag List Protected error