Hi, Paul,

Several other folks have given good, comprehensive explanations.  I
might add a simple trick;  read

    any [...]

as if it were a synonym for

    first_established_value_in [...]

where "established" means something other than none or false.  It's
saying "try these in this order, and quit as soon as you find one"
(in a loose sort of way).

REBOL allows you to make puns in logic-oriented expressions; none is
considered to be false, and everything else (other than false and its
synonyms no and off) is considered to be true.  As a consequence,

    foo: any [ gorp bletch quux flarp "default"]

can be used as short-hand for the imperative code

    either found? gorp and gorp [               foo: gorp      ][
        either found? bletch and bletch [       foo: bletch    ][
            either found? quux and quux [       foo: quux      ][
                either found? flarp and flarp [ foo: flarp     ][
                                                foo: "default"
    ]   ]   ]   ]

For example, if I have a Great Big Hairy Database of contact and
address data (and some suitable function definitions ;-), I could
write

    your-address: any [
        your-home-address
        your-work-address
        your-parents-address
        general-delivery-to-your-home-town
        "no address on file"
    ]

-jn-

Reply via email to