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

[REBOL] Binding

From: robert:muench:robertmuench at: 18-Nov-2002 17:39

Hi, I have the following code: forall-records: func [list predicate action /local object][ if any [none? list empty? predicate empty? action][return none] list: select list 'values predicate: bind/copy predicate 'list action: bind/copy action 'list ; iterate through the whole list of values ; check if the first entry satisfies the predicate ; if so execute the action. foreach [id object] list [ if do predicate [do action] ] ] Within predicate and action I would like to have access to id and object. And from action I would like to have access to the local variables from the caller's context. I tried the following: result: make block! [] forall-records graph/nodes [?? object][append result id] Of course this doesn't work! Problem is that local object isn't accessible (it's none). I thought that bind is not static (meaning: all words in the block are bound to the words known until bind was called) instead will give you access to all local words. But it seems this is not the case. Any idea how to solve it the smart way? Robert