Hi, all

this works also with foreach (not only with loop and repeat):

use [insert-only break-return res] [
 insert-only: func [series value] [insert/only series value]
 break-return: func [value] [break/return value]
 res: func [value] [func [] reduce [value]]
 collectB: func [
  {Collects block evaluations, use as body in For, Repeat, etc.}
  block [block!] "Block to evaluate."
  /initial result [series!] "Initialize the result."
  /only "Inserts into result using the Only refinement."
 ][
  initial: res reduce [none any [make result result make block! 10]]
  reduce [
   :loop 1 reduce [
    :change :initial reduce [:break-return]
    pick reduce [:insert :insert-only] not only
     :tail :second :initial :do block
     ;:do block could be to-paren block, to make it a little more fast
     ; but so the block is copyed
    :change :initial none
   ]
   :do :initial
  ]
 ]
]

---
Ciao
Romano

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to