MathGroup Archive 2010

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

Search the Archive

Re: looping

On 27 Jan 2010, at 07:31, Richard Fateman wrote:

> Andrzej Kozlowski wrote:
>> On 25 Jan 2010, at 11:08, Leonid Shifrin wrote:
>>> Besides, changes to this seem unlikely because this
>>> is a fundamental mechanism behind scoping in Module, and it has been =
>>> way for a very long time (I don't know since which version but I =
wouldn't be
>>> surprised if it  was there already in version 1).
>> Actually there was no Module in version 1. (e.g. see the =
documentation for Module). Module was introduced in Version 2. Version 1 =
had only Block.
>> Andrzej Kozlowski
>> (Nice tricks, by the way. I have know about some of them for a long =
time but others are new to me.)

> Unfortunately, if you have several independent programs perhaps =
written by different people and they each generate persistent names via  =
Module[{...,r...} ...] and you load them into the same system  then THEY =
can conflict.
> consider
> g1[x_]:=Module[{r},If[NumberQ[A[r]],Print[r],A[r]=0]]
> run it a bunch of times.  Save g1 and A in file f1
> start up a new system
> define
> g2[x_]:=Module[{r},If[NumberQ[A[r]],Print[r],A[r]=1]]
> run it a bunch of times.  Save g2 and A in file f2.
> start up a new system
> load files f1 and f2.
> the behavior of g1 and g2 will be, so far as I can tell, dependent on
> the (random?) setting of some inaccessible counter in Mathematica.

This is very good, but still I think it falls short of the quality of an =
earlier example of why Richard would "shy away from a presentation that =
required the reader to own a free Mathematica player". I mean that he =
might want to write "a paper whose topic was the Mathematica Player =

I think if not exactly a world record, that post was a record of sorts =
for this forum. This one, while still pretty good, is not really keeping =
up with that standard.

I do hope some day instead of warning us of the possible problems that =
might be caused by his imaginative though somewhat contrived examples of =
"possible" user behaviour, Richard tries to produce an actual, "real =
life" example. Perhaps he could start by trying to generate this =
"possible conflict" by following the procedure he has so kindly produced =
as a warning to all of us. With luck this will keep him occupied for a =

Andrzej Kozlowski=

  • References:
    • looping
      • From: glenn kuhaneck <>
    • Re: Re: looping
      • From: Leonid Shifrin <>
  • Prev by Date: Re: looping
  • Next by Date: Re: looping
  • Previous by thread: Re: looping
  • Next by thread: Re: looping