MathGroup Archive 1992

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

Search the Archive

Re: Indexed Scan

  • To: mathgroup <mathgroup at yoda.physics.unc.edu>
  • Subject: Re: Indexed Scan
  • From: HAY at LEICESTER.AC.UK
  • Date: Fri, 10 JUL 92 16:28:16 GMT
  • Mailer: Janet_Mailshr V3.4 (23-May-1989)

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

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

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

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

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

Allan Hayes
Department of Mathematics
The University
Leicester LE1 7RH
U.K.
Tel: 0533-714198
hay at leicester.ac.uk 





  • Prev by Date: 3-script to Renderman Parser?
  • Next by Date: time series
  • Previous by thread: re: 3-script to Renderman Parser?
  • Next by thread: Re: Indexed Scan