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

[REBOL] Re: Searching in "table"

From: carl::cybercraft::co::nz at: 5-Sep-2007 15:41

On Tuesday, 4-September-2007 at 20:27:12 Kai Peters wrote,
>That was a horrible read - let me try this again: > >I am struggling with this problem: > >Given the "table" > >table: [ > [ 3 "Tim" "Peterson" 2 ] > [ 1 "John" "Smith" 3 ] > [ 2 "Jeff" "Brown" 1 ] >] > >How can I search for the record whose first value is 1 (John Smith) >and return its index in the table (2 in this case) ? > >The search criterion is only unique in the fist value of each "record".
This would be one way... forall table [if table/1/1 = 1 [print index? table]] But I agree with MAx that you could make it simplier by changing the the way the table's organized. -- Carl Read.