Re: List
- To: mathgroup at smc.vnet.net
- Subject: [mg25881] Re: [mg25876] List
- From: BobHanlon at aol.com
- Date: Tue, 7 Nov 2000 02:55:54 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 11/4/2000 3:20:23 AM, carlos.silva at tcontas.pt writes: >Can you explain me how a define a function that select the name of the >persons that have more than 10 values and give as result a list only the >name of that people. > > > <<...>> > <<...>> > <<...>> > <<...>> > >But a only want as result the list: {Jose Dias,Luisa Silva, Maria Duarte, >Nuno Lopes}. > Since there are no examples, the format of your data is unknown. Consequently, I can only suggest that you look at using Cases or Select. For example, alpha = CharacterRange["A", "Z"]; (data = Table[ Join[{"Name " <> alpha[[k]]}, Range[k, 2k + 4]], {k, 8}]) // ColumnForm {"Name A", 1, 2, 3, 4, 5, 6} {"Name B", 2, 3, 4, 5, 6, 7, 8} {"Name C", 3, 4, 5, 6, 7, 8, 9, 10} {"Name D", 4, 5, 6, 7, 8, 9, 10, 11, 12} {"Name E", 5, 6, 7, 8, 9, 10, 11, 12, 13, 14} {"Name F", 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} {"Name G", 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18} {"Name H", 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20} Cases[data, x_?(Length[#] > 10 &) :> x[[1]]] {"Name E", "Name F", "Name G", "Name H"} First /@ Select[data, Length[#] > 10 &] == % True Bob Hanlon