Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Multiple Find Function

 [1/3] from: reboler::programmer::net at: 20-Feb-2002 19:21


Is the output of the following what you wanted? Anybody have improvements? To search blocks try multi-find to-string yourblock value. multi-find: func [ "Find multiple instances of a value in a series and output their index position" ser [series!] "series to search" val "value to find" /local found out ][ out: copy/deep reduce [val []] parse ser [any [thru val found: (append out/2 (index? found) - length? val)]] return out ]

 [2/3] from: reboler:programmer at: 20-Feb-2002 19:27


Ooops! I meant multi-find: func [ "Find multiple instances of a value in a series and output their index position" ser [series!] "series to search" val "value to find" /local found out ][ out: copy/deep reduce [val []] parse ser [any [thru val found: (append out/2 (index? found) - length? val)]] out ] Notice that there is no "return" anywhere in site ;)

 [3/3] from: al:bri:xtra at: 21-Feb-2002 16:12


Alan wrote:
> out: copy/deep reduce [val []]
The above line is better as: out: reduce [val make block! 2] Andrew Martin ICQ: 26227169 http://valley.150m.com/ -><- ----- Original Message ----- From: "alan parman" <[reboler--programmer--net]> To: <[rebol-list--rebol--com]> Sent: Thursday, February 21, 2002 1:27 PM Subject: [REBOL] Re: Multiple Find Function
> Ooops! > > I meant > > multi-find: func [ > "Find multiple instances of a value in a series and output their index
position"
> ser [series!] "series to search" > val "value to find" > /local found out > ][ > out: copy/deep reduce [val []] > parse ser [any [thru val found: (append out/2 (index? found) - length?
val)]]
> out > ]
<<quoted lines omitted: 4>>
> http://www.mail.com/?sr=signup > 1 cent a minute calls anywhere in the U.S.!
http://www.getpennytalk.com/cgi-bin/adforward.cgi?p_key=RG9853KJ&url=http:// www.getpennytalk.com

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted