Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: A ToExpression question

  • To: mathgroup at
  • Subject: [mg58352] Re: A ToExpression question
  • From: "Jens-Peer Kuska" <kuska at>
  • Date: Tue, 28 Jun 2005 21:56:49 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <d9r4h4$53i$>
  • Sender: owner-wri-mathgroup at


f2[] is a replacement rule that say replace all 
symbols of x in the body
of f2[] with the argument. Since the body make no 
reference to the symbol x
it will not replaced.

The Module[] in f3[] will create a symbol y$1, 
y$2, .. with a new number
at the end for every call. But the symbol will 
*never* y alone and so
no replacement with x->0 take place.


"Ray Koopman" <koopman at> schrieb im 
Newsbeitrag news:d9r4h4$53i$1 at
> f1[x_] := Print[x];
> f2[x_] := ToExpression["Print[x]"];
> f3[x_] := Module[{y = x}, 
> ToExpression["Print[y]"]];
> f4[x_] :=  Block[{y = x}, 
> ToExpression["Print[y]"]];
> Scan[#[0]&,{f1,f2,f3,f4}]
> 0
> x
> y
> 0
> Why don't f2 and f3 print 0 ?

  • Prev by Date: Re: A ToExpression question
  • Next by Date: Re: False image plot
  • Previous by thread: Re: A ToExpression question
  • Next by thread: Re: A ToExpression question