[REBOL] Who is that grouch? -or- Fun with functions! Re:
From: allen:rebolforces at: 5-Oct-2000 15:54
----- Original Message -----
From: <[joel--neely--fedex--com]>
To: <[list--rebol--com]>
Sent: Thursday, October 05, 2000 1:35 PM
Subject: [REBOL] Who is that grouch? -or- Fun with functions!
> I fear that anyone reading my last few posts may conclude that I'm
> a real grouch. (Of course, it's not necessary to read my emails to
> draw that conclusion! ;-)
>
> In the interest of Suitable Doses of Levity, let's have fun with
> functions in REBOL!
>
> First, let's define an oldie from APL:
>
> >> iota: function [n [integer!]] [r i] [
> [ r: copy []
> [ i: 0
> [ while [i < n] [append r i: i + 1]
> [ r
> [ ]
Hi Grouchy ;)
iota: function [n [integer!]][r i][
r: copy []
repeat i n [append r i]
]
Using the 'repeat native is quicker. (by about 1 sec per 1000 iterations on
my machine).
Thanks for the fun..
Allen K