[REBOL] Re: using type? with switch
From: joel:neely:fedex at: 2-Oct-2001 10:59
Jeff Kreis wrote:
> > Is is possible to use the result of type? with switch?
> > I.e. if I want to use switch to dispatch based on different
> > data types, it seems I have to use to-string on the result
> > of type? for use with switch. Is that the case or am
> > I missing something?
>
> Here's an example:
>
> probe switch type?/word var [
> string! [lowercase var]
> email! [uppercase var]
> block! [random var]
> ...
> ]
>
Hmmm... Fascinating, in view of
>> vi: 123
== 123
>> type? vi
== integer!
>> to-word type? vi
** Script Error: Expected one of: word! - not: datatype!
** Where: to-word
** Near: to word! :value
which precludes the obvious
switch to-word type? var [
string! [...]
integer! [...]
decimal! [...]
...
]
-jn-
--
This sentence contradicts itself -- no actually it doesn't.
-- Doug Hofstadter
joel<dot>neely<at>fedex<dot>com