Re: Re: Is this a bug?

*To*: mathgroup at smc.vnet.net*Subject*: [mg32097] Re: [mg32096] Re: Is this a bug?*From*: Paul van Wamelen <wamelen at math.lsu.edu>*Date*: Mon, 24 Dec 2001 03:32:44 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

First, thanks to all that responded to my question, I learned all kinds of thing from your responses. Still, I think the point is still being missed: I understand what is going wrong, I know how to fix it, but: Is there some good reason why Increment is not implemented as Attributes[incr] = {HoldFirst}; incr[x_[a__]] := With[{t2 = a}, With[{t1 = x[t2]}, x[t2] = t1 + 1; t1]]; incr[x_] := With[{t1 = x}, x = t1 + 1; t1]; but more like (Allan Hayes'): Attributes[incr]={HoldFirst}; incr[x_]:= With[{t=x},x=t+1;t] I think the first way has two advantages: 1) It's what people expect (as Alan Mason points out) and 2) It is more efficient (especially for Increment[a[_something slow to evaluate_]]) Is being efficient here really "inconsistent with Mathematica's general view of things" (of being "hyperdynamic, always allowing for possible future changes to rules and their side effects, at the cost of some extra evaluations")? Sincerely, Paul van Wamelen