Re: transforming a rule of lists to a list of rules

• To: mathgroup at smc.vnet.net
• Subject: [mg69146] Re: [mg69098] transforming a rule of lists to a list of rules
• From: János <janos.lobb at yale.edu>
• Date: Thu, 31 Aug 2006 04:38:58 -0400 (EDT)
• References: <200608301032.GAA27888@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```On Aug 30, 2006, at 6:32 AM, Ken Senior wrote:

> Hello everyone.
>
> Does anyone know a way to transform a rule involving a list into a
> list
> of individual rules, that is to interpret the rule elementwise?  For
> example, given
>
>    {a,b,c} -> {0,3,x}
>
> is there a transformation which will turn this into
>
>    {a->0, b->3, c->x}
>
> Thanks for the help!
>
> Ken

Here is a newbie approach:

In[1]:=
rl = {a, b, c} -> {x, y, z}
Out[1]=
{a, b, c} -> {x, y, z}

In[2]:=
Table[rl[[1,i]] -> rl[[2,i]],
{i, 1, Length[rl[[1]]]}]
Out[2]=
{a -> x, b -> y, c -> z}

With the best,

János

----------------------------------------------
Trying to argue with a politician is like lifting up the head of a
corpse.
(S. Lem: His Master Voice)

```

• Prev by Date: Re: transforming a rule of lists to a list of rules
• Next by Date: Unexpected "Invalid comparison" error when plotting function defined with a Condition pattern
• Previous by thread: Re: transforming a rule of lists to a list of rules