[REBOL] Re: I hate computers!
From: joel:neely:fedex at: 4-Jan-2003 14:23
Hi, Gabriele,
Gabriele Santilli wrote:
> And of course, one could also write:
>
> valid-type?: func [
> parameter [any-type!]
> datatypes [block!] ; are you sure to want series! here?
> ] [
> found? find reduce datatypes type? parameter
> ]
>
(see my red face... At least I ended up with the same solution as
yours, which makes me cheerful! ;-)
> Anyway, this function has the little problem of not working with
> pseudo-types. (Just warning you, maybe you don't need to use
> them.)
>
That reminds me of a couple of other interesting question whichs I
never put the thought into solving, but which someone on the list
may have already pondered:
1) Since pseudo-types (e.g., SERIES!) are simply identified by
REBOL as data types (not a distinct "pseudo-type" type), what
is the best way to determine whether a value of type DATATYPE!
is a "physical" type or a "pseudo" type?
2) Given two datatypes, is there a simple way to determine whether
one is a super-type of the other?
super-type? number! integer! ==> true
super-type? series! string! ==> true
super-type? number! logic! ==> false
super-type? any-string! file! ==> true
Any suggestions (other than brute-force enumeration, of course)
would be welcomed!
-jn-