Rule application issue
- To: mathgroup at smc.vnet.net
- Subject: [mg34143] Rule application issue
- From: jabidof at yahoo.fr (Jari)
- Date: Mon, 6 May 2002 05:20:12 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Dear Mathgroup,
Consider the following list:
In[353]:=
allDataCollected={{{2,b+w},{6,d+t}},{{5,f},{4,g},{7,l}},{{{2,1},a},{{4,5},
h},{{6,5},j},{{5,4},k},{{8,1},m}}};
Here is the result I want:
In[354]:=
Distribute[{allDataCollected[[1]],
allDataCollected[[2]]}, List, List, List, ({{#1[[1]], #2[[1]]},
#1[[2]] \
#2[[2]]})&]
Out[354]=
{{{2,5},f (b+w)},{{2,4},g (b+w)},{{2,7},l (b+w)},{{6,5},f
(d+t)},{{6,4},
g (d+t)},{{6,7},l (d+t)}}
The problem occurs when I try to obtain the same result but using
rules (which is mandatory for my application):
In[355]:=
allDataCollected/.{{NE__},{NS__},{A___}}\[Rule]
Distribute[{{NE}, {NS}}, List, List,
List, ({{#1[[1]], #2[[1]]}, #1[[2]] #2[[2]]})&]
I get part specifications errors :-(
Anybody's got an idea?
Thanks for your help,
Jari