MathGroup Archive 1995

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

Search the Archive

Paolo's question


Paolo asked how, given a list of pairs, each of which has a number for
its second entry, to find the first entry of that pair for which the
second is a maximum among all the second entries.  The following gets
all such first entries in case the maximum is attained more than once.

In[1]:= quack={ {a,2}, {b,4}, {c,1}, {d,4} };

In[2]:= First /@ Cases[quack, {_,Max[Last /@ quack]}]

Out[2]= {b, d}

Will Self


  • Prev by Date: Re: wierd REmove behavior
  • Previous by thread: Speed foe Mma ans Win95