Re: With[{software=Mathematica}, Frustration]
- To: mathgroup at smc.vnet.net
- Subject: [mg24319] Re: [mg24308] With[{software=Mathematica}, Frustration]
- From: Maarten.vanderBurgt at icos.be
- Date: Sun, 9 Jul 2000 04:52:30 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
Try With[{a = 2, b = 3}, Evaluate[c]].
Maarten
AES <siegman at stanford.edu> on 07-07-2000 06:11:52 AM
Subject: [mg24319] [mg24308] With[{software=Mathematica}, Frustration]
Pages 359-360 of The Mathematica Book says (admittedly, taken a little
out of context),
"You can think of With as a generalization of the /. operator. . ."
and
" With[{x=x0}, body] works essentially like body /. x->x0 . . . "
Great, looks neat, let's try it for evaluating expressions without
permanently setting the variables in them:
In[1]:= c = a b
Out[1]= a b
In[2]:= c
Out[2]= a b
In[10]:= c /. {a -> 2, b -> 3}
Out[10]= 6
In[3]:= With[{a = 2, b = 3}, c]
Out[3]= a b
*Not* what I was hoping for . . .