Re: Scoping, named patterns, local vs global variables
- To: mathgroup at smc.vnet.net
- Subject: [mg44902] Re: Scoping, named patterns, local vs global variables
- From: frankeye at cox.net (Frank Iannarilli)
- Date: Sun, 7 Dec 2003 06:03:47 -0500 (EST)
- References: <bqmqus$r95$1@smc.vnet.net> <bqpncl$931$1@smc.vnet.net> <bqs95b$i1b$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi David,
Thanks, as always, for your help. I suppose this does serve my
intention, described in my add-on to the group thread, to get the
benefit of instant rhs evaluation of all else but the Unevaluated[]
named pattern. Presuming your approval (hopefully), I'm going to post
this email to the group thread for benefit of all, thanks!
Regards,
Frank
--On Thursday, December 04, 2003 2:31 PM -0600 David Withoff
<withoff at wolfram.com> wrote:
>
> For variables to be localized, those variables must be held unevaluated
> until some localization action can be invoked. Set, TagSet, and Rule
> do not hold their arguments unevaluated, and so can behave as scoping
> constructs only if those arguments are held unevaluated by some other
> mechanism, as in
>
> In[]:= x=1;f[x_]=Unevaluated[x^2];f[3]
>
> Out[]= 9
>
> or
>
> In[]:= Module[{b},b=2;x=1;f[x_]=x^b;f[3]]
>
> Out[]= 9
>