MathGroup Archive 1995

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

Search the Archive

Re: I don't know how to ....

  • Subject: [mg2440] Re: I don't know how to ....
  • From: pehowland at (Paul E Howland)
  • Date: Thu, 9 Nov 1995 04:43:39 GMT
  • Approved:
  • Distribution: local
  • Newsgroups: wri.mathgroup
  • Organization: LSC2 Division, Defence Research Agency
  • Sender: daemon at ( )

In article <471hgv$gb3 at>, bientin at (Paolo Bientinesi) writes:

|here's my problem:
|I need  a function that takea as input a list of pairs;
|the first element of every pair is a list, the second one is an integer;
|I want the function to calculate thhe
|biggest integer and to give as output the corresponding list.

Assuming your list is like:

	data = {{{1,2,3},0}, {{4,5,6},5}, {{7,8,9},3}}

then the following will work:

	In[1]:= Part[data, Position[
			Map[#[[2]]&, data],
			Max[Map[#[[2]]&, data]]
			][[1,1]], 1]
	Out[1]= {4, 5, 6}

Hope this helps,

Paul E Howland                                  Tel. +44 (0)1684 895767
Long Range Ground Radar Sensors                 Fax. +44 (0)1684 896315
LSC2 Division                                 Email. PEHOWLAND at DRA.HMG.GB
Defence Research Agency
St Andrews Road
Worcestershire, WR14 3PS, UK

  • Prev by Date: Re: remote kernels
  • Next by Date: Curve fitting
  • Previous by thread: Re: I don't know how to ....
  • Next by thread: Re: I don't know how to ....