Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1992

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

Search the Archive

Re: Indexed Scan

  • To: mathgroup <mathgroup at>
  • Subject: Re: Indexed Scan
  • From: HAY at
  • Date: Fri, 10 JUL 92 16:28:16 GMT

>I have found a method to return an index value from the scanning of an list.
>In fact, is impossible to know the "place" where Scan yield to some desirable

>Another functions like, Position or Select only work with pattern, no
>functions and then they can not return values or stop themself until they
>finish with the array.

>  yt=Sin /@ Range[0,10,.5];
>  c=0;Scan[If[(c++;# < 0),Return[c]]&, yt]
>  8

We can use all 4 slots for Position:
               Position[expr, pattern, listspec, howmany]

    Position[yt,x_/;x<0 ,{1}, 1][[1,1]]

Allan Hayes
Department of Mathematics
The University
Leicester LE1 7RH
Tel: 0533-714198
hay at 

  • Prev by Date: teaching
  • Next by Date: Re: Rule and First
  • Previous by thread: Re: Indexed Scan
  • Next by thread: time series