[REBOL] Re: R: Re: switch and datatype
From: g:santilli:tiscalinet:it at: 7-Jul-2001 14:52
Hello Romano!
On 06-Lug-01, you wrote:
RT> tipo: string! switch to-word mold tipo [string! [print
RT> "switched"]]
Is there any reason you can't use:
tipo: 'string!
or
tipo: type?/word value-to-check
RT> tipo: string! switch tipo compose [ (reduce string!) [print
RT> "switched"]]
You can remove the REDUCE here.
RT> Compose reduce a little.
Hmm... I don't this it will be any faster (slower, maybe). Anyway,
you'll usually do this only once so this is not a problem.
Also, notice that:
>> switch string! ["" [print "A-ha!"]]
A-ha!
which is probably simples, provided you're dealing with types
that can be represented literally (lexically?).
Regards,
Gabriele.
--
Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/