       Re: Evaluate part of rhs of RuleDelayed

• To: mathgroup at smc.vnet.net
• Subject: [mg91090] Re: [mg91081] Evaluate part of rhs of RuleDelayed
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Wed, 6 Aug 2008 05:03:16 -0400 (EDT)
• References: <200808051028.GAA14053@smc.vnet.net>

```Here is a rather obvious although, perhaps, not a very elegant solution:

SomeComplexFunction[a_] := Module[{x, SCF}, x = a*a;
{value -> SCF[x + a]} /. {Rule -> RuleDelayed, SCF ->
SomeComplexFunction}]

In:= SomeComplexFunction
Out= {value :> SomeComplexFunction(30)}

Andrzej Kozlowski

On 5 Aug 2008, at 12:28, Eugene Kirpichov wrote:

> I am writing a lazy recursive function (actually, a tree of UI widgets
> that is too large to be constructed at once).
> Consider, for example, the following code:
>
> SomeComplexFunction[a_] := Module[{x},
>  x = a*a;
>  {value :> SomeComplexFunction[x + a]}]
>
> The value of SomeComplexFunction is {value :>
> SomeComplexFunction[x\$7418 + 5]} and seemingly can'd be used for
> anything useful.
>
> Question:
> How should I fix the code of SomeComplexFunction so that the value of
> SomeComplexFunction be {value :> SomeComplexFunction} ?
>
> Unfortunately, this one
>
> SomeComplexFunction[a_] := Module[{x},
>  x = a*a;
>  {value :> SomeComplexFunction[Evaluate[x + a]]}]
>
> yields {value :> SomeComplexFunction[Evaluate[x\$7421 + 5]]}
>
> --
> Eugene Kirpichov
> Web IR developer, Yandex
>

```

• Prev by Date: Re: Recognize vector expression
• Next by Date: Re: Simplify
• Previous by thread: Re: Evaluate part of rhs of RuleDelayed
• Next by thread: Re: Evaluate part of rhs of RuleDelayed