Re: List Operations
- To: mathgroup at smc.vnet.net
- Subject: [mg65889] Re: List Operations
- From: Paul <gleam at flashmail.com>
- Date: Fri, 21 Apr 2006 01:33:25 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
LectorZ, You already have a number of solutions, but here is one using Sow and Reap that is worth noting. In[1]:= tbl={ {1, q, r}, {2, a, m}, {1, g, z}, {1, p, d}, {3, b, g}, {3, n, x}, {2, j, t}, {3, c, y}, {1, h, v} }; In[2]:= Reap[Sow[#2 #3, #]& @@@ tbl, _, {#, Tr@#2}&][[2]] Out[2]= {{1, d p + q r + h v + g z}, {2, a m + j t}, {3, b g + n x + c y}} Paul