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

Refinements

 [1/3] from: c:brizell:worc:ac at: 29-Aug-2000 13:43


All, Is it possible to programatically use refinements? I would like to do the following count: ["one" "two" "three" "four" .......] data-struct: [ this: 1 words: [ "some-word' [ title "some-title" ] ] one [........] two [......] three [.......] ] res: first data-struct/[second count] Thanks in anticipation colinb Colin Brizell IT System Development Officer University College Worcester Tel: 01905 855389 Fax: 01905 855330 http://www.worc.ac.uk

 [2/3] from: allen::rebolforces::com at: 29-Aug-2000 23:22


Hi Colin, Hopefully this will give you an idea. we can't use the path notation of data-struct/"string" but we can use it this way path: "string" data-struct/:path ;---Here's a modified version of your example. data-struct: [ this: 1 words: [ "some-word" [ title "some-title" ] ] "one" [1] "two" [2] "three" [3] "four" [4] ] foreach item count [probe data-struct/:item] ; result is [1] [2] [3] [4] ;----- Cheers, Allen K

 [3/3] from: bhandley:zip:au at: 30-Aug-2000 0:36


Like this perhaps? count: ["one" "two" "three" "four"] data-struct: [ this: 1 words: [ "some-word" [ title "some-title" ] ] "one" [......] "two" [ "i picked block two" ] "three" [.......] ] selector: second count res: first data-struct/:selector ; Note the get-word notation .... == "i picked block two" note that you could do this as well:
>> res: first select data-struct second count
== "i picked block two" Brett.