Given the REBOL source file below (named "describe.r") ...

    REBOL []

    types: [block? block! number? number! decimal? decimal!]

    listtypes: func [
    ][
        foreach [qry typ] types [
            print qry
            print typ
            print "?"
        ]
    ]

    checktypes: func [
        arg
    ][
        foreach [qry typ] types [
            b: reduce [q arg]
            print mold b
        ]
    ]

... I can do the following in the REBOL shell ...

    >> do %describe.r
    >> listtypes
    block?
    block!
    ?
    number?
    number!
    ?
    decimal?
    decimal!
    ?
    >> checktypes 3

... at which point (after pressing 'enter') the REBOL shell drops into
a black hole!  Specifically, the window instantly vanishes, as does the
executing interpreter's task.  This is happening in version 2.1.2.3.1
running on w95.

soooo...

1)  What's happening?

2)   How do I do the following:  construct a list of function/action
     pairs, which can be processed against an argument by applying
     each function to the argument, then performing the corresponding
     action if the result is 'true?

     I know I can write a series of 'if statements, but want to make
     this data driven without a wad of redundant code for each case.

Thanks in advance for all words of wisdom!
-jn-

Reply via email to