Re: Nested Lists, Definition and Evaluation.
- To: mathgroup at smc.vnet.net
- Subject: [mg59779] Re: Nested Lists, Definition and Evaluation.
- From: "dkr" <dkrjeg at adelphia.net>
- Date: Sat, 20 Aug 2005 03:15:09 -0400 (EDT)
- References: <de45o1$quj$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
(1) Part assignments are only permitted for values of a symbol.
b[[1,1]] (unevaluated) is not a symbol.
(2) b[[1,1]][[1,1]] and b[[1,1,1,1]] and b[[1,1][[1]][[1]] and
b[[1]][[1]][[1]][[1]] all pick out the same part
With respect to your example concerning the second question:
b[[1,1,1,1]] does not generate an error message because b is a symbol.
In[32]:=
b = Table[Symbol["a" <> ToString[ i] <> ToString[j]], {i, 2}, {j, 2}];
a11={{1,1},{1,1}};
a12={{1,2},{1,2}};
a21={{2,1},{2,1}};
a22={{2,2},{2,2}};
In[37]:=
b
Out[37]=
{{{{1,1},{1,1}},{{1,2},{1,2}}},{{{2,1},{2,1}},{{2,2},{2,2}}}}
In[38]:=
{b[[1,1,1,1]],b[[1,2,2,1]],b[[2,2,2,2]]}={5,6,7}
Out[38]=
{5,6,7}
In[39]:=
b
Out[39]=
{{{{5,1},{1,1}},{{1,2},{6,2}}},{{{2,1},{2,1}},{{2,2},{2,7}}}}