Hi Elan,

You asked:

>some time ago you sent a datatype hierarchy to the mailing list. How did
>you assemble that info?

I don't have any way to put together the whole hierarchy in one go,
but this function is fun to use:

>> show-all-types 0
any-type! number! integer!
>> show-all-types "string"
any-type! series! any-string! string!
>> show-all-types first [just/a/path]
any-type! series! any-block! path!
>> show-all-types make error! "We're ****ed!"
error! any-type!

Speaking of datatypes, here's a puzzle! (If you're sick of puzzles, think
of it as a conundrum ;-)

Why does this happen?

>> array2: func third :array second :array
>> array2 8
** Script Error: array2 expected size argument of type: datatype datatype.
** Where: array2 8

Later,
Eric

----------

show-all-types: func [
    {print out all relevant datatypes for a value}
    value [any-type!]
    /local typelist valuelist to-do
][
    foreach [type list] reduce [
        unset!     "unset!"
        datatype!  "datatype!"
        action!    "any-function! action!"
        op!        "any-function! op!"
    ][
        if type = type? get/any 'value [print ["any-type!" list]  exit]
    ]
    alltypes: []
    if tail? alltypes [
        foreach word first system/words [
            if datatype? get/any word: in system/words word [
                append alltypes get word
            ]
        ]
    ]
    typelist: copy []
    valuelist: head insert/only copy [] :value
    foreach type alltypes [
        if find valuelist type [
            append typelist mold type
        ]
    ]
    print typelist
]

Reply via email to