Re: Position of element in a list
- To: mathgroup at smc.vnet.net
- Subject: [mg16382] Re: Position of element in a list
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Thu, 11 Mar 1999 02:16:50 -0500
- References: <7bt665$ndn@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Roger Mason wrote in message <7bt665$ndn at smc.vnet.net>...
>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
>
>
Roger,
Position[{-1, 3, -2, 1}, _?Negative]
{{1},{3}}
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565