MathGroup Archive 2011

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

Search the Archive

Re: Variables within With statement

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123833] Re: Variables within With statement
  • From: markholtuk <markholtuk at googlemail.com>
  • Date: Thu, 22 Dec 2011 04:25:06 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jccg39$mb4$1@smc.vnet.net> <jchh07$i99$1@smc.vnet.net> <jcpfr4$qi3$1@smc.vnet.net>

On Dec 20, 8:09 am, Szabolcs <szhor... at gmail.com> wrote:
> On Saturday, 17 December 2011 08:39:51 UTC+1, markholtuk  wrote:
> > You could try delaying assignment of a, as follows:
>
> > In[1]:= With[{a := a = 5, b = 10 a}, a + b]
>
> > Out[1]= 55
>
> Please note that this solution modifies the global variable 'a', and therefore defeats the purpose of With (which is defining *local* constants).


Indeed. Apologies for this. The Christmas run-up appears to be having
its usual effect on my IQ!



  • Prev by Date: Annoying problem.
  • Next by Date: Re: Span Set nasty bug
  • Previous by thread: Re: Variables within With statement
  • Next by thread: integrate a sum using Mathematica