       RE: Re: Replacing Parts of a List

• To: mathgroup at smc.vnet.net
• Subject: [mg28826] RE: [mg28771] Re: Replacing Parts of a List
• From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.de>
• Date: Tue, 15 May 2001 00:58:58 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Roger,

things are a little bit tricky, since symbol[[indices]] is a special form in
Mathematica. Trying to define Upvalues for Subscript didn't work for
Set[Part[..]]. So an idea would be to modify parsing of a subcripted
expression, and convert that to special symbols:

In:=
MakeExpression[SubscriptBox[x_, y_], StandardForm] :=
MakeExpression[RowBox[{StringJoin["\[Section]", x, "\[Section]", y]}],
StandardForm]

In:= \!\(x\_y\  = \ {1, 2, 3}\)
Out= {1, 2, 3}

In:= \!\(x\_y[\(\)] = 10\)
Out= 10

In:= \!\(x\_y\)
Out= {1, 2, 10}

so any piece of input Substring[x,y] is converted to an internal symbol §x§y
(which will not come to your eye, if you give it a value at definition time,
as done above).

Try whether this will suffice to your purpose. Alternatively I've heard of a
Package "Symbolize", which  will do this (?) and other things, but I have
neither used that nor studied.

Good luck, -- Hartmut

> -----Original Message-----
> From: Roger Jones [mailto:rmj at SLAC.Stanford.EDU]
To: mathgroup at smc.vnet.net
> Sent: Saturday, May 12, 2001 7:37 AM
> To: mathgroup at smc.vnet.net
> Subject: [mg28826] [mg28771] Re: Replacing Parts of a List
>
>
> To clarify
>
> In:=Subscript[x, y] = {1, 2, 3}
>
> Out1]={1, 2, 3}
>
> To replace the third element I must use :
>
> In:=Subscript[x, y] = ReplacePart[Subscript[x, y], 10, 3]
>
> Out={1, 2,10}
>
> So that now Subscript[x, y] gives:
>
> In:=Subscript[x, y]
>
> Out={1, 2, 10}
>
>
> This is unwieldy and I was hoping for a little more condensed
> notation.
> However,
> when using subscripts this appears appears to be the simplist notation
> available.
>
> -Roger Jones
>
>

```

• Prev by Date: Re: Re: Problem overriding simple built-in functions
• Next by Date: Re: Det[]
• Previous by thread: Re: Replacing Parts of a List