Hi, Ladislav. Thanks for throwing in your two cents. Let's smunch my 'Collect with yours and pick out the best survivor!
; Ladislav's: use [insert-only] [ insert-only: func [series value] [insert/only series value] collect: func [ {Collects block evaluations, use as body in For, Repeat, etc.} block [block!] "Block to evaluate." /initial result [series!] "Initialise the result." /only "Inserts into result using the Only refinement." ] [ result: any [make result result make block! 10] reduce [ :head pick reduce [ :insert :insert-only ] not only :tail result :do block ] ] ] ; Andrew's (just for Carl... :) ): >> source collect collect: func [ "Collects the results of block evaluations." Block [block!] "The block to 'do." /Only "Inserts the result as a series." /Full "Don't ignore none! values." /Initial Type [series! datatype!] "Specifies the type of the result." ][ use [Break Result Results] [ Break: func [ "Breaks out of the 'Collect." /Return "Forces the loop function to return a Value." Value [any-type!] ] [ system/words/break/return either Return [ Value ] [ Results ] ] Results: any [ all [ datatype? Type make Type 0 ] Type copy [] ] compose/deep [ if not any [ unset? set/any 'Result do [(bind Block 'Break)] (pick [[none? :Result] []] not Full) ] [ (pick [insert insert/only] not Only) tail Results :Result Results ] Results ] ] ] Anyone else want to collide their code into the pile? :) Andrew J Martin Breeding the best Rebol code in this hemisphere! ICQ: 26227169 http://www.rebol.it/Valley/ http://valley.orcon.net.nz/ http://Valley.150m.com/ -><- -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.