MathGroup Archive 2007

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

Search the Archive

Re: Anyone used the Notation package in v6 already?


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?