Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

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


  • Prev by Date: wanna see something glaringly weird?
  • Next by Date: Re: No success with a package from the Wolfram Website
  • Previous by thread: Re: List Operations
  • Next by thread: 3D ContourGraphics alternative