Re: Position of element in a list
- To: mathgroup at smc.vnet.net
- Subject: [mg16416] Re: Position of element in a list
- From: Basudev Chaudhuri <bc26 at cornell.edu>
- Date: Sat, 13 Mar 1999 02:21:35 -0500
- Organization: Cornell University
- References: <7bt665$ndn@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Roger,
The following works
Position[{-1, 3, -2, 1}, x_ /; x < 0 ]
Here you choose that patterns conditionally.
Hope this helps.
--Basu
Roger Mason wrote:
> Hi,
>
> I want to find the Position[] of negative elements in a list. The obvious
> methods do not work:
>
> Position[{-1, 3, -2, 1}, -_]
>
> and
>
> Position[{-1, 3, -2, 1}, -x_]
>
> return
>
> {}
>
> So how do I perform this apparently simple task?
>
> Thanks,
>
> Roger Mason