[REBOL] Re: for bug?
From: g:santilli:tiscalinet:it at: 18-Jun-2002 19:37
Hi Joel,
On Monday, June 17, 2002, 8:51:19 PM, you wrote:
JN> foreachin gleep bletch [...]
My QAD solution:
foreachin: func ['word object body /local result] [
if none? object [return none]
body: func reduce [word] body
if not all [in object 'next in object 'current] [make error! "Invalid object"]
until [
set/any 'result body object/current
object/next
]
get/any 'result
]
range: func [start end' bump'] [
if end' - start / bump' < 1 [return none]
context [
current: start
end: end'
bump: bump'
op?: either positive? bump [:greater?] [:lesser?]
next: does [
current: current + bump
op? current end
]
]
]
>> foreachin i range 1 10 1 [print i]
1
2
3
4
5
6
7
8
9
10
>> foreachin i range 10 1 -1 [print i]
10
9
8
7
6
5
4
3
2
1
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r