Re: list assignment problem
- To: mathgroup@smc.vnet.net
- Subject: [mg12488] Re: list assignment problem
- From: "Allan Hayes" <hay@haystack.demon.cc.uk>
- Date: Tue, 19 May 1998 13:31:51 -0400
- References: <6jf5l1$47a@smc.vnet.net>
Abdallah Rayhan wrote in message <6jf5l1$47a@smc.vnet.net>...
>I am trying to write a program that requires handling 3D list. I am
>faced with this problem which is unable to change the values of the
>list. For example, when I run the following lines, I get this error
>msg: Part::setps: jlist[[1]] in assignment of part is not a symbol.
>
>In[294]:= jlist={{1,2},{3,4}}
>
>Out[294]= {{1, 2}, {3, 4}}
>
>In[295]:= jlist[[1]][[2]]=6
>
>Part::setps: jlist[[1]] in assignment of part is not a symbol.
>
>Out[295]= 6
>
>I would appreciate if any one could tell me what I am doing wrong ?
>
Abdallah,
This works
jlist[[1,2]]=6
The reason that jlist[[1]][[2]]=6 does not work is, as the message
indicates. We have:
HoldForm[FullForm[jlist[[1]][[2]]=6]]
Set[Part[Part[jlist,1],2],6]
Allan
--
Allan Hayes
Training and Consulting
Leicester UK
http://www.haystack.demon.co.uk
hay@haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44(0)116 271 8642