Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Warsaw Univ. course, was Re: Work on Basic Mathematica
Replies: 2   Last Post: Jun 3, 2013 11:15 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Richard Fateman

Posts: 286
Registered: 12/7/04
Re: Warsaw Univ. course, was Re: Work on Basic Mathematica
Posted: Jun 3, 2013 11:15 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 6/3/2013 9:25 AM, Leonid Shifrin wrote:

<long message>

Thanks for what I consider a most agreeable contribution.
I was not aware of your material on stackexchange, which seems
to be rather nice.


You are right that my example regarding mutable Lists in Mathematica
was incorrect. Actually on two grounds. The syntax was not right and
I did not mean to say that Lists in Mathematica are not mutable, since
they certainly are.

Just that Lists have the uncomfortable property that if you access one
element,
all the others are re-evaluated. Here is an example, which I think is
free of
mis-used syntax...

( q=Table[f[i],{i,1,3}];
f[n_]:=(Print[n];g[n]))

q[[2]]

evaluates to display
1
2
3
g[2]

Changing q by, for example, q[[2]]=hello
does not re-evaluate the elements.
However, referring to in again as q[[2]] does this:
1
3
hello

Thanks for pointing out the original error.
RJF






Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.