Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] On comparing with none! [was Re: WYSIWYG programming]

From: joel::neely::fedex::com at: 1-Nov-2000 11:35

Hi, all, Jeff raised another set of questions in the thread on comparing logic! values which I didn't address at the time. Real life intruded and the flood of subsequent email buried the original post deeply enough that it took me a while to remember the unfinished business! [jeff--rebol--net] wrote:
> Okay, so you would like the following: ...
The issue is not that I desire a specific answer to a particular question; rather, I desire that REBOL give a *consistent* answer to all variations of the *same* question (in all cases!).
> true > false == true
Yes (since REBOL already says that
>> (to-integer true) > (to-integer false)
== true
>> sort reduce [true false on off yes no]
== [false false false true true true]
> so.. > > none < false == ?
Well, I had not addressed that issue. RCUG is clear (IMHO) that logic! and none! are distinct types, and I was only talking about the issue of comparing *within* a single datatype. But, keep reading...
> so what are the results to the following: > > false < "foo" > > false < http://foo.bar > > false < 0 > > false < -1 > > false < print "This will be unset" > > etc... ? >
Since YOU brought it up ... ;-) Let's ask REBOL what it thinks.
>> sort reduce [false none "foo" http://foo.bar 0 -1 print "unset"]
unset == [unset none false -1 0 "foo" http://foo.bar] Sorting is just comparing things and rearranging them until all pairs of adjacent elements are in order (left-hand <= right-hand). Therefore, according to REBOL, we should get the following answers to your questions above.
> none < false -> true > false < "foo" -> true > false < http://foo.bar -> true > false < 0 -> true > false < -1 -> true > false < print "This will be unset" -> false
I really haven't been able to think of any reason why Sort should give answers that are inconsistent with the evaluations of < <
> and >= *especially* since Sort allows the /Compare refinement,
where presumably I *must* be able to evaluate < <= > and >= on values that Sort could otherwise order with a default comparison.
> Also in REBOL, TRUE is equivalent in a test to: (not none > and not false) >
Well... more inconsistency appears when we mix none! in with operations on logic! values...
>> true and true == true >> true and false == false >> true and none == false >> false and true == false >> false and false == false >> false and none == false
but all of the following
>> none and true
** Script Error: Cannot use and~ on none! value. ** Where: none and true
>> none and false
** Script Error: Cannot use and~ on none! value. ** Where: none and false
>> none and none
** Script Error: Cannot use and~ on none! value. ** Where: none and none violate the standard rule (from either philosophical logic or mathematical logic) that "and" is symmetric -- the order of the arguments is not supposed to matter -- so that p and q should *always* be equal to q and p In addition to the inconsistency, this demonstrates that (at least *sometimes*!) REBOL thinks that None and False are *not* interchangeable. -jn- -- ; Joel Neely [joel--neely--fedex--com] 901-263-4460 38017/HKA/9677 REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] { | e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]