[REBOL] Re: Problems with block of datatype!s
From: tim::johnsons-web::com at: 12-Sep-2001 11:10
On Wed, Sep 12, 2001 at 10:55:45AM -0700, Holger Kruse wrote:
> On Wed, Sep 12, 2001 at 09:40:34AM -0800, Tim Johnson wrote:
> > I would like to be able to test a word for a
> > match in a block whose members are datatypes.
> >
> > The example code doesn't do what I want it to do:
> > >> types: [string! number!]
> > == [string! number!]
> > >> find types string!
> > == none ; was hoping for [string! number!]
> > >> types/1 = string!
> > == false ; was hoping for 'true
> > Just curious: what else do I need to do here?
>
> Change
> types: [string! number!]
> to
> types: reduce [string! number!]
>
> The reason is: In your block, "string!" is an unevaluated
> word (type word!), but in your call to 'find "string!"
> gets evaluated and becomes the datatype! "string!". Words
> are different from datatypes, so no match is found.
> Reducing the block evaluates the words in it and converts
> them to datatypes, allowing 'find to do what it should.
Thanks Holger
> This is not a bug btw.
I had no suspicion that it would be, I suspected that the
answer would be in 'bind or 'reduce which are rebol terms
that my feeble brain has yet to fully absorb.
Also: Holger, if you are still on line, I need to post
something that I wish to CC to you and Carl. A small
piece of good news for Rebol ..... which might need your
input.
regards
tim