list referencing with [[ ]][[ ]]
- To: mathgroup at smc.vnet.net
- Subject: [mg13969] list referencing with [[ ]][[ ]]
- From: tdelling at ews.uiuc.edu (Tim Dellinger)
- Date: Fri, 11 Sep 1998 15:06:57 -0400
- Organization: University of Illinois at Urbana-Champaign
- Sender: owner-wri-mathgroup at wolfram.com
According to "the book" section 1.8.4,
t[[1]][[2]] "is equivalent to" t[[1,2]], "but is clumsier to write"
and that is all that I can find concerning the difference between the
two ways of refering to a list element.
But...
In[37]:=
alist = {{1,2},{3,4}}; alist[[2,1]] = 7 ; alist
Out[37]=
{{1,2},{7,4}}
So far so good, and yet...
In[39]:=
anotherlist = {{1,2},{3,4}}; anotherlist[[2]][[1]] = 7
Set::"setps":
"\!\(anotherlist \\[LeftDoubleBracket] 2 \\[RightDoubleBracket]\) in
\
assignment of part is not a symbol."
Out[39]=
7
What's the problem here? Is there a difference between the two ways of
referencing list elements that "the book" neglects to mention?
--
--
"Perhaps my most deeply rooted hobby is to understand Tim
Dellinger
the mechanisms of simple and familiar
tdelling at uiuc.edu
natural phenomena." Irving Langmuir
http://www.ews.uiuc.edu/~tdelling