Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2013

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

Search the Archive

DelayedRule assembly

  • To: mathgroup at smc.vnet.net
  • Subject: [mg131600] DelayedRule assembly
  • From: "Dave Snead" <dsnead6 at charter.net>
  • Date: Tue, 10 Sep 2013 03:35:08 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <20130909040609.9789D6A14@smc.vnet.net>

Hi,

I'm trying to assemble a delayed rule from components.

The rule I want is:

In[1]:=  rule0 = f[y_] :> ({x, z} = g[]; h[x, y, z])
Out[1]= f[y_] :> ({x, z} = g[]; h[x, y, z])

The components I have are:
In[2]:= c1 = f[y_];
        c2 = {x, z};
        c3 = g[];
        c4 = h[x, y, z];

Some attempts that do not work are:

In[6]:=  rule1 = RuleDelayed[c1, (c2 = c3; c4)]
Out[6]=  f[y_] :> (c2 = c3; c4) 

In[7]:= rule2 = RuleDelayed[c1, Evaluate@(c2 = c3; c4)]
Out[7]= f[y_] :> h[x, y, z]

How can I write a RuleDelayed expression using c1,c2,c3,c4 
which returns an expression identical to rule0 above?

Thanks in advance,
Dave Snead





  • Prev by Date: Re: Integrating special functions
  • Next by Date: Re: "Nice" complex form
  • Previous by thread: Re: "Nice" complex form
  • Next by thread: Re: DelayedRule assembly