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

[REBOL] Re: cyclic values

From: ingo:2b1 at: 29-Sep-2002 15:18

Hi Patrick, Am Son, 2002-09-29 um 10.50 schrieb pat665: <...>
> colors: [red green blue] > > ; I want color to be red, then green, then blue, then red again forever > ; the first value is duplicated > > color: first colors > append colors color > > ; then forever > color: select colors color
That looks like a pretty clever use of select to me. My ideas would have been: for i 1 10 1 [ print colors/1 colors: next colors if tail? colors [colors: head colors] ] or i: 1 for j 1 10 1 [ print pick colors i i: i // (length? colors) + 1 ] But I like your version much more. Kind regards, Ingo