[REBOL] Re: can't quite get it right...
From: joel:neely:fedex at: 8-Sep-2001 5:26
Allen Kamp wrote:
> > Unfortunately, there are situations in which a LOGIC! value
> > is expected -- which ALL may not supply -- so one may have
> > to resort to saying
> >
> > to-logic all [#"A" <= ch ch <= #"Z"]
>
> In this case I would prefer to use
> found? all [#"A" <= ch ch <= #"Z"]
>
> as (IMHO) "found?" signals the intention of the function
> better than "to-logic"
>
YMMV. TMTOWTDI.
When using ALL as a "short-circuit" version of AND, my intent
is to produce a boolean value. In my mental model for that
case, I'm not asking whether a result was found, but asking
for the boolean equivalent of the result. This is necessary
because of the pun REBOL makes with NONE (just as LISP did
with nil).
If I were using ALL in a chain-of-defaults context...
all [find this-frame "sometag"
find prior-frame "sometag"
find base-frame "sometag"
find base-frame "default"]
I'd more likely be thinking in terms of whether a result were
FOUND? or not.
As long as we're talking about FOUND?, that brings up the
possibility of solving the original problem with FIND, as in
>> find charset [#"A" - #"Z"] #"S"
== true
>> find charset [#"A" - #"Z"] #"$"
== none
>>
or (of course) the above prefixed with FOUND? if a boolean
result is required.
-jn-
--
------------------------------------------------------------
Programming languages: compact, powerful, simple ...
Pick any two!
joel'dot'neely'at'fedex'dot'com