[REBOL] Ifs Re:(2)
From: lmecir:geocities at: 12-Oct-2000 8:23
Hi Joel,
I am not glad, that I must disappoint you, but see the following example:
a: 1
b: to paren! [to paren! [to paren! [to paren! [a: 0 - a]]]]
ifs-for-dummies b [negative: ["Negative"] zero: ["Zero"] positive:
["Positive"]]
== "Zero"
I think, you should read Exception #5 for Word Evaluation of my Rebol/Core
User's
Guide Comments once again and hope, that this will be interesting even for
others...
Regards
Ladislav
P.S. My strong opinion is, that the best you can get is:
signed-if: func [
{If positive do positive-block, zero do zero-block, negative do
negative-block}
[throw]
condition [number! char! money! time!]
positive-block [block!]
zero-block [block!]
negative-block [block!]
] [
either positive? condition [do positive-block] [
either negative? condition [do negative-block] [do zero-block]
]
]
I am afraid, that Signed-if-for-dummies may become a victim of the GC bug
and similar issues, when used recursively...