Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: Warsaw Univ. course, was Re: Work on Basic Mathematica
Posted:
Jun 3, 2013 11:15 PM


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 reevaluated. Here is an example, which I think is free of misused 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 reevaluate the elements. However, referring to in again as q[[2]] does this: 1 3 hello
Thanks for pointing out the original error. RJF



