| Author |
Comment/Response |
J. Herrera
|
11/28/99 08:35am
When I input this in Mathematica version 3
foo=bar[k_]->k;
Do[Print[bar[1]/.foo],{k,3}]
I get the output
1
2
3
Instead of just 1's. It looks like the iterator modifies the rule in each pass. But page 365 in the Mathematica Book says that variables in rules
are treated as local, regardless of other scoping constructs (and without an explicit Module or Block statement). Also, I've tried wrapping
my rule in Block/Module, and it's no use. What am I missing here? How can I rewrite this so that the iterator doesn't modify my rule?
Thanks in advance,
J. Herrera
URL: , |
|