MathGroup Archive 1998

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

Search the Archive

Re: list referencing with [[ ]][[ ]]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg13991] Re: [mg13969] list referencing with [[ ]][[ ]]
  • From: Xah Lee <xah at best.com>
  • Date: Sat, 12 Sep 1998 16:59:15 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

At 7:06 PM -0000 1998.09.11, Tim Dellinger wrote:
>According to "the book" section 1.8.4,
>
>t[[1]][[2]] "is equivalent to" t[[1,2]], "but is clumsier to write"
>...
>
>But... 

The answer can be found by looking at FullForm,

In[17]:=
FullForm[Hold[li[[1]][[2]]]]

Out[17]//FullForm=
Hold[Part[Part[li,1],2]]

In[18]:=
FullForm[Hold[li[[1,2]]]]

Out[18]//FullForm=
Hold[Part[li,1,2]]

Both forms acts equivalently when you use them to extract an element,
but for assignment, Part[Part[li,1],2]=x is not the same as
Part[li,1,2]=x.


 Xah, xah at best.com
 http://www.best.com/~xah/PageTwo_dir/more.html
 Perl: all unix's stupidity in one.




  • Prev by Date: Two column style-sheet
  • Next by Date: Re: Re: Vectors
  • Previous by thread: list referencing with [[ ]][[ ]]
  • Next by thread: Wolfram Research Grant Programs