MathGroup Archive 2007

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

Search the Archive

Re: Anyone used the Notation package in v6 already?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg77295] Re: Anyone used the Notation package in v6 already?
  • From: Donald DuBois <dfd01 at comcast.net>
  • Date: Wed, 6 Jun 2007 07:19:37 -0400 (EDT)

Hello,

lst = {{1, 0}, {1, 1}, {2, x + x^2 + x^4}, {2, 1 + x + x^2 + x^4}, {4, 
  x + x^2}, {4, 1 + x + x^2} ... }
First /@ lst // Tally

will produce

{{1, 2}, {2, 2}, {4, 10}, {5, 8}, {8, 10}}

which is the number of 1's, 2's, 4's etc. as the first element of the sublists.

In a little less cryptic form, 

Tally[Map[First , lst]]

Will accomplish the same thing.

Regards,
Don


  • Prev by Date: Re: Segregating the elements of a list based on given lower and
  • Next by Date: Re: Iterate through a list help
  • Previous by thread: Anyone used the Notation package in v6 already?
  • Next by thread: Re: Anyone used the Notation package in v6 already?