Hello [EMAIL PROTECTED]!
On 15-Gen-00, you wrote:
l> ; polymorphic if with lazy evaluation and minimal checking
l> pif: func [args [block!] /local current cond r] [
l> current: args
l> while [not empty? current] [
l> r: do/next current
l> if cond: first r [
l> either logic? cond [
l> r: do/next second r
l> return do first r
l> ] [return do cond]
l> ]
l> r: do/next second r
l> current: second r
l> ]
l> false
l> ]
This behaviour can be simulated with the REBOL code:
do any [
all [cond1 [code1]]
all [cond2 [code2]]
...
[default]
]
which is not readable, anyway. When I was writing that do-cases
dialect, I wanted to create something like that... That wasn't
easy, so I went for this:
any [
if cond1 [code1]
if cond2 [code2]
...
do [default]
]
with some adjustments for 'if and defining (just for readability)
'else-if and 'else.
In conclusion, I don't know which approach is better, so use
whatever you like (or both...). ;-)
Regards,
Gabriele.
--
o--------------------) .-^-. (----------------------------------o
| Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila |
| GIESSE on IRC \ \-\_/-/ / http://www.amyresource.it/AGI/ |
o--------------------) `-v-' (----------------------------------o