MathGroup Archive 2001

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

Search the Archive

Summing list subsets

  • To: mathgroup at
  • Subject: [mg30711] Summing list subsets
  • From: "Mark Coleman" <mcoleman at>
  • Date: Sat, 8 Sep 2001 02:55:38 -0400 (EDT)
  • Organization: BondSpace, Inc.
  • Sender: owner-wri-mathgroup at


Consider two lists:

x = {a,a,b,b,b,b,c,d,d,d,d,d,} and  y = {1,1,2,2,2,2,3,4,4,4,4,4}

I would like to have a function that returns the sum (or any other function)
of each unique element of x, given the corresponding value in y. That is,
for a 'Sum', the result would be


This is similar in spirit to a common database aggregation problem.

Any ideas?



  • Prev by Date: Changing the default font to arial
  • Next by Date: algebraic substitution rules
  • Previous by thread: Re: Changing the default font to arial
  • Next by thread: Re: Summing list subsets