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

[REBOL] Re: cyclic values

From: carl:cybercraft at: 29-Sep-2002 23:38

On 29-Sep-02, pat665 wrote:
> Hi List, > I want to get values in order from a block, the first value coming > again after the last, and this forever. Is there a better way than > the one I am using now ?
There may be, but it's pretty nice as it is. That said, if the colors block was very long it might give variable performance between finding color near the beginning and near the end of the block.
> 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
-- Carl Read