Paolo's question
- To: mathgroup at smc.vnet.net
- Subject: [mg2394] Paolo's question
- From: wself at viking.emcmt.edu (Will Self)
- Date: Tue, 31 Oct 1995 23:24:22 -0500
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