MathGroup Archive 2004

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

Search the Archive

Re: Re: Sequential evaluation of lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53125] Re: [mg53097] Re: Sequential evaluation of lists
  • From: George Woodrow III <georgevw3 at mac.com>
  • Date: Fri, 24 Dec 2004 05:59:14 -0500 (EST)
  • References: <200412231258.HAA21147@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

The behavior of x++ is exactly the same in c, and I think that this is 
intentional.

I do know that in c, the example is a classic of bad programming style 
-- the type of thing one would expect in an Obfuscated C Contest.

There is terse, compact code, and there is terse compact, unusable 
code. This is an example fo the latter.


george

On 23 Dec, 2004, at 7:58 am, Bill Rowe wrote:

> On 12/22/04 at 4:53 AM, koopman at sfu.ca (Ray Koopman) wrote:
>
>> When I first started using Mathematica (v2), one of the features
>> that I found rather surprising is its sequential evaluation of
>> lists, as in
>
>> In[1]:= x = 0; {x++,x++,x++}
>> Out[1]= {0,1,2}
>
>> I had expected a warning that such code should be avoided because
>> it presumed sequential evaluation, which could not be guaranteed,
>> and a recommendation to treat list elements as being evaluated in
>> parallel -- if not simultaneously then in no particular order.
>> However, so far I have found no exception to sequential evaluation
>> and no mention of it in any documentation. Have I missed something?
>
> I don't whether this is behavior is documented somewhere or not. In 
> any software as complex and extensive as Mathematica there will always 
> be behavior that is undocumented. Undocumented behavior is always 
> subject to change in future versions. And it is quite possible this 
> specific behavior is undocumented
>
> Most likely, something as basic as the order of evaluation on 
> expressions in a list will not change for some time, particularly on a 
> single processor system. But for some future highly parallel system, 
> this might change.
>
> If you are writing code you expect to use for sometime and want to 
> minimize the effort needed to update the code for future versions, you 
> should avoid relying on undocumented behavior. Or at the very least, 
> put sufficient comments in the code so that you can easily locate 
> those places that rely on undocumented behavior.
> --
> To reply via email subtract one hundred and four
>


  • Prev by Date: Import Function on Version 5.
  • Next by Date: Re: Information about subscripted function
  • Previous by thread: Re: Sequential evaluation of lists
  • Next by thread: Re: Sequential evaluation of lists