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

[REBOL] Rolling your own ideal looper: does Repeat still have a bug? Re:(4)

From: lmecir:geocities at: 28-Aug-2000 22:10

Hi, being asked I try to explain my changes. 1. Thanks, Gabriele, I forgot to use one more Throw, but the original is needed too. I used Throw attribute to make sure, that any Return or Exit contained in code like: f: does [ideal-looper elem indx [1 2 3] [exit]] does what it should, ie. causes the exit of F. 2. Any-type! specification is needed, because a series in Rebol can contain even eg. Unset! values, in which case the function without the spec. wouldn't work. 3. For uses While anyway, so it is a shortcut. (see Source For, but look out! It still contains the series bug I reported to feedback.) The corrected version: ideal-looper: func [ [throw] 'element [word!] 'index [word!] series [series!] code [block!] /local f i ] [ f: func reduce [[throw] element [any-type!] index] code i: 1 while [i <= length? series] [f series/:i i i: i + 1] ] Regards Ladislav