Re: Select any
- To: mathgroup at smc.vnet.net
- Subject: [mg101959] Re: Select any
- From: fd <fdimer at gmail.com>
- Date: Fri, 24 Jul 2009 06:13:24 -0400 (EDT)
- References: <h4955q$q9l$1@smc.vnet.net>
On Jul 23, 5:57 pm, Niko <niko.schw... at googlemail.com> wrote: > does mathematica have something like "select any" that gets any > element of a list that satisfies a criterion? yes, the command Select[list,crit] you can also use the command Cases[list,pattern] e.g. list={{1,0},{2,1},{3,2}} select any whose first element is > 1 Select[list,#[[1]]>1&] out:={{2, 1}, {3, 2}}