Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Sequential evaluation of lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53097] Re: Sequential evaluation of lists
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Thu, 23 Dec 2004 07:58:55 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

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: Re: Sequential evaluation of lists
  • Next by Date: Zero testing
  • Previous by thread: Re: Sequential evaluation of lists
  • Next by thread: Re: Re: Sequential evaluation of lists