Re: Sort problem
- To: mathgroup at smc.vnet.net
- Subject: [mg56328] Re: [mg56292] Sort problem
- From: "Sepulveda, Ariel" <arielsep at hp.com>
- Date: Fri, 22 Apr 2005 06:22:59 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
A few ideas on Sort: age = {30, 12, 60, 20}; names = {"john", "kate", "peter", "alice"}; {age, names} // Sort {age, names} // Sort // Transpose Sort[{age, names} // Transpose, #1[[1]] < #2[[1]] &] Sort[{age, names} // Transpose, #1[[1]] > #2[[1]] &] Sort[{age, names} // Transpose, #1[[2]] < #2[[2]] &] Sort[{age, names} // Transpose, #1[[2]] > #2[[2]] &] Sort[{age, names} // Transpose, #1[[1]] < #2[[1]] &] // Transpose Sort[{age, names} // Transpose, #1[[1]] > #2[[1]] &] // Transpose Sort[{age, names} // Transpose, #1[[2]] < #2[[2]] &] // Transpose Sort[{age, names} // Transpose, #1[[2]] > #2[[2]] &] // Transpose -----Original Message----- From: konstantpi at mail15.com [mailto:konstantpi at mail15.com] To: mathgroup at smc.vnet.net Subject: [mg56328] [mg56292] Sort problem Hi How to sort two lists such as: age={30,12,60,20}; pple={"john","kate","peter","alice"}; to give the output: age={12,20,30,60} pple={"kate","alice","john","peter"} ie: to keep every person opposite his age number. thanks