[REBOL] Re: Testing block of types
From: nitsch-lists::netcologne::de at: 18-Oct-2003 20:19
Am Samstag, 18. Oktober 2003 19:53 schrieb Tim Johnson:
> Hello Rebols:
> ;; I would like to test the type of a value
> ;; or would agains a block of data types.
>
> ;; consider the console session below:
> >> test: [number! series! money! time! date! char!]
>
> == [number! series! money! time! date! char!]
>
> >> type? test/1
>
> == word!
>
> >> find test 'number!
>
> == [number! series! money! time! date! char!] ;; so far so good
> ;; Now test to see if the type of a value is in the 'test block
>
> >> find test (type? 2)
>
> == none ;; well, I would expect a hit here :(
>
> What notation do I need here to make a sucessful test.
type?/word
otherwise it return a datatype!, which molds the same as the word datatype!,
but it is not. the word number! is set to the value number!, which is
confusing. you can use reduce too.
!>> mold/all reduce [number! series! money! time! date! char!]
== {[#[datatype! number!] #[datatype! series!] #[datatype! money!] #[datatype!
time!] #[datatype! date!] #[datatype! char!]]}
ing.
>> type? type? 2
== datatype!
>> type? type?/word 2
== word!
> thanks!
> tim
-Volker