Re: List Position
- To: mathgroup at smc.vnet.net
- Subject: [mg15769] Re: [mg15740] List Position
- From: Carl Woll <carlw at fermi.phys.washington.edu>
- Date: Sun, 7 Feb 1999 02:03:50 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Harry, The most straightforward solution is to use Position[], as in Position[{{1},{1},{2},{8},{-3}}, a_ /; a<=0, 2, 1] The syntax for Position is Position[expr, pattern, levelspec, n] where n tells mathematica to retrieve the first n positions which match the pattern. Carl Woll Dept of Physics U of Washington On Fri, 5 Feb 1999, Harry flynn wrote: > Can anyone tell me how I find the position in a list of the first value > less than or equal to zero. > For example, how can I get Mathematica to tell me that in the list > {{1},{1},{2},{8},{-3}} > that the first value of interest to me is position 5. Thanks in advance. > Harry. > >