Re: looping
- To: mathgroup at smc.vnet.net
- Subject: [mg106907] Re: looping
- From: Andrzej Kozlowski <akozlowski at gmail.com>
- Date: Wed, 27 Jan 2010 06:24:23 -0500 (EST)
- References: <201001210955.EAA16523@smc.vnet.net> <201001251008.FAA09381@smc.vnet.net> <hjmjja$g0$1@smc.vnet.net> <4B5FDDBD.9070503@cs.berkeley.edu>
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 = this >>> 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 = itself". 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 = while... Andrzej Kozlowski=
- References:
- looping
- From: glenn kuhaneck <mcguyver128@yahoo.com>
- Re: Re: looping
- From: Leonid Shifrin <lshifr@gmail.com>
- looping