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

• To: mathgroup at smc.vnet.net
• Subject: [mg69161] Re: [mg69098] transforming a rule of lists to a list of rules
• From: Ken Levasseur <klevasseur at mac.com>
• Date: Thu, 31 Aug 2006 04:39:31 -0400 (EDT)
• References: <200608301032.GAA27888@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```This doesn't test for whether the two lists have equal lengths, but
that would be easy to add:

In[15]:=
delist = #1 /. {({a__} -> {b__}) :> (Rule @@ #1 & ) /@ Transpose
[{{a}, {b}}]} &

Out[15]=
#1 /. {({a__} -> {b__}) :> (Rule @@ #1 & ) /@ Transpose[{{a}, {b}}]} &

In[16]:=
delist[{a, b, c} -> {0, 3, x}]

Out[16]=
{a -> 0, b -> 3, c -> x}

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
>

Ken Levasseur
UMass Lowell

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

```

• Prev by Date: Re: Is -1^(2/5) really undefined in R?
• Next by Date: Re: transforming a rule of lists to a list of rules
• Previous by thread: Re: transforming a rule of lists to a list of rules
• Next by thread: Re: transforming a rule of lists to a list of rules