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

[REBOL] Re: Iterators & Functionids

From: robert:muench:robertmuench at: 27-Aug-2002 20:20

> -----Original Message----- > From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]] > On Behalf Of Gabriele Santilli > Sent: Tuesday, August 27, 2002 12:39 PM > To: Robert M. Muench > Subject: [REBOL] Re: Iterators & Functionids > What about: > > foreach-record: func ['word records predicate action] [ > predicate: func reduce [word] predicate > action: func reduce [word] action > foreach record records [ > if predicate record [action record] > ] > ]
Hi, looks good to me. I came up with the following solution: forall list [ object: first list if (do bind copy predicate 'list) [do bind copy action 'list] ] Within the predicate & action block you now have access to 'object. Using bind makes it possible to get access to the local words. I use copy to avoid destroying the global context binding of the provided blocks. Robert