MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Position of element in a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16363] Re: Position of element in a list
  • From: "Atul Sharma" <mdsa at musica.mcgill.ca>
  • Date: Thu, 11 Mar 1999 02:16:39 -0500
  • References: <7bt665$ndn@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Try this:

Position[{-1, 3, -2, 1}, _?Negative]
Out: {{1},{3}}

I believe it accomplishes what you asked.

A. Sharma

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
>
>




  • Prev by Date: Re: Position of element in a list
  • Next by Date: Assertion propagation
  • Previous by thread: Re: Position of element in a list
  • Next by thread: Re: Position of element in a list