Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #15512 > unrolled thread

Re: list mutability (very basic question)

Started byAlan G Isaac <alan.isaac@gmail.com>
First post2013-09-22 06:41 +0000
Last post2013-09-22 06:41 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: list mutability (very basic question) Alan G Isaac <alan.isaac@gmail.com> - 2013-09-22 06:41 +0000

#15512 — Re: list mutability (very basic question)

FromAlan G Isaac <alan.isaac@gmail.com>
Date2013-09-22 06:41 +0000
SubjectRe: list mutability (very basic question)
Message-ID<l1m3ea$cdh$1@smc.vnet.net>
On 9/21/2013 10:15 AM, Bob Hanlon wrote:
 > Attributes[Set]
 > {HoldFirst, Protected, SequenceHold}


Thanks, but I'm still unclear:
why does ``{0}[[1]]=1`` raise an error?

As a point of reference for my confusion,
Python behaves in a way I find more intuitive:
``[0,1][1]=0`` does not raise an error.
(This becomes an interesting difference when
we get to argument passing in Mathematica, where HoldFirst
becomes useful as a way to allow "in place" modification.)

Back to Mathematica, am I understanding correctly that after
``Set[Part[x,1],1])`` that x still references the
same location in memory?  How can I easily see that?
(E.g., in Python, I would us the ``id`` function.)

Thanks,
Alan Isaac

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web