The script below...

    REBOL []

    types: [
        block?    block!
        decimal?  decimal!
        function? function!
        integer?  integer!
        number?   number!
        string?   string!
        word?     word!
    ]

    testtypes: func [
        arg
        /local
        sep
    ][
        print [(type? arg) ": " (mold arg)]
        sep: ""
        foreach [qry typ] types [
            if do qry arg [
                prin [sep typ]
                sep: ", "
            ]
        ]
        print ""
    ]

...allows the block 'types to contain function/something pairs, and
iterates through 'types using the functions as selectors for the
corresponding somethings of interest.

I still have the unpleasant sensation that I'm speaking REBOL with
a Java accent, however.  Stylistic suggestions would be welcome!

-jn-

Reply via email to