Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*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 1998

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

Search the Archive

Scoped variables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg13898] Scoped variables
  • From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
  • Date: Sun, 6 Sep 1998 02:55:35 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Consider the lines below.  You get nothing very interesting at Out[1].

In[n]:=
Clear[a];
x=2;
{a_->x^2,  x_->x^2,  x_}//InputForm

Out[1]=
{a_ -> 4,  x_ -> 4,  x_}


It works a little different if you do the same thing inside With (see
below).

In[2]:=
With[{x=7},{a_->x^2,  x_->x^2,  x_}]//InputForm

Out[2]=
{a$_ -> 49,  x_ -> 4,  Pattern[7, _]}


I understand there were extensive discussions on this sort of thing in
this group in recent years.  However, I can't find anything, mostly
because I haven't figured out how to use the MathGroup search engine. 
Anyway I figured some members would still be  interested.

Ted Ersek



  • Prev by Date: Graphics Line Styles
  • Next by Date: diary command?
  • Previous by thread: Re: Graphics Line Styles
  • Next by thread: Re: Scoped variables