Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*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 2002

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

Search the Archive

Re: Strange ReplaceAll behavior

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36794] Re: Strange ReplaceAll behavior
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Thu, 26 Sep 2002 04:56:46 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <amriq5$53u$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

because te right hand side of SetDelayed[] is not
evaluate.

Try

ru[a] = a -> x;
f[x_] := (a + b) /. ru[a];
f1[x_] := Evaluate[(a + b) /. ru[a]];

and f1[] does what you expect
In[]:={f[c], f1[c]}
Out[]={b + x, b + c}

Regards
  Jens

"Lawrence A. Walker Jr." wrote:
> 
> Hi,
> 
> For the life of me I am not sure why the following is not working in my
> v. 4.2:
> 
> ru[a]=a->x;
> f[x_]:=(a+b) /. ru[a];
> 
> Why do I get
> f[c] = b+x
> 
> and not
> f[c] = b+c?
> 
> What gives?
> 
> Thanks,
> Lawrence
> 
> --
> Lawrence A. Walker Jr.
> http://www.kingshonor.com


  • Prev by Date: The Innovation Algorithm
  • Next by Date: Real Time Animation
  • Previous by thread: RE: Strange ReplaceAll behavior
  • Next by thread: Re: Strange ReplaceAll behavior