In einer eMail vom 24.02.00 03:25:34 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

> I have a series with multiple identical entries, but different values:
>  
>  [ "book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "M&M" ]
>  
>  I want to search the series for each occurrence of say "book" and then 
>  evaluate it for a match.  How can I do this?  Or, is select perhaps not 
the 
>  right hammer to beat this puzzle with?
>  
>  
>> i: a  s: "book"
== "book"
>> while[i: find i s][ probe i  i: next i ]
["book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "M&M"]
["book" "The Stand" "candy" "Mars Bar" "candy" "M&M"]

Trick: find itself returns position in a series, you can simple continue from 
here. Good Design :)
Attention! This does not work with hash!

stepwise beyond:

>> s: "book"
== "book"
>> a: [ "book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" 
"M&M" ]
== ["book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "M&M"]
>> b: find a s
== ["book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "M&M"]
>> c: next b
== ["The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "M&M"]
>> d: find c s
== ["book" "The Stand" "candy" "Mars Bar" "candy" "M&M"]
>> ;...
>>
>> ;so
>> i: a  s: "book"
== "book"
>> while[i: find i s][ probe i  i: next i ]
["book" "The Hobbit" "book" "The Stand" "candy" "Mars Bar" "candy" "M&M"]
["book" "The Stand" "candy" "Mars Bar" "candy" "M&M"]
== none
>>
>> i: a  s: "M&M" ; make shure it works on end..
== "M&M"
>> while[i: find i s][ probe i  i: next i ]
["M&M"]
== none


Gruss Volker

Reply via email to