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

[REBOL] Re: Making series

From: al:bri:xtra at: 20-Oct-2001 8:33

> In Haskell there is a very easy way to create lists.
As too in Rebol:
>> iota 1 5
== [1 2 3 4 5] Of course, you'll need this, first:
>> source iota
iota: func [ {Makes a block containing a range of values, from Start to End.} [catch throw] Start [number! series! money! time! date! char!] "Starting value." End [number! series! money! time! date! char!] "Ending value." /By Bump [number! money! time! char!] "Amount to skip each time." /local Block][ throw-on-error [ all [ none? Bump Bump: 1 ] Block: make block! End - Start / Bump for I Start End Bump [ insert tail Block I ] Block ] ] And you can do neat things like:
>> iota now now + 3
== [20-Oct-2001/8:32:42+13:00 21-Oct-2001/8:32:42+13:00 22-Oct-2001/8:32:42+13:00 23-Oct-2001/8:32:42+13:00] :-) I hope that helps! Andrew Martin ICQ: 26227169 http://valley.150m.com/