Mailing List Archive: 49091 messages

## [REBOL] Re: Antwort: Re: WYSIWYG programming

### From: joel:neely:fedex at: 27-Oct-2000 9:03

```
Hi, Gabriele,

Thanks for catching the errors!

of values still applies.

Perhaps my point would have been better made by saying the following:

>> foo: ["a" "b" "c" "d"]             == ["a" "b" "c" "d"]

Therefore Foo contains a sorted set of values, which means that if
the positions are in order, the values are in order.

>> 1 < 2                                                 == true
>> (pick foo 1) < (pick foo 2)                           == true

This is true even when the "positions" are not integers, and seems
(at first!) consistent with converting the non-integer "positions"
to integer! values.

>> 1.5 < 2.3                                             == true
>> (to-integer 1.5) < (to-integer 2.3)                   == true

>> (pick foo 1.5) < (pick foo 2.3)                       == true
>> (pick foo to-integer 1.5) < (pick foo to-integer 2.3) == true

We're not allowed to Pick using a character! value directly, but can
still get results that are consistent with the explicit order of
character! values.

>> #"^a" < #"^b"                                         == true
>> (to-integer #"^a") < (to-integer #"^b")               == true

>> pick foo to-integer #"^a"                             == "a"
>> pick foo to-integer #"^b"                             == "b"
>> (pick foo to-integer #"^a") < (pick foo to-integer #"^b")
== true

We're not allowed to compare logic! values directly, but there is an
implicit order based on converting between logic! and integer!

>> to-integer false                          == 0
>> to-integer true                           == 1
>> (to-integer false) < (to-integer true)    == true

However, using logic! values with Pick breaks the pattern of "ordered
positions contain ordered values for a sorted block"

>> (to-integer false) < (to-integer true)    == true
>> (pick foo false) < (pick foo true)        == false  !!!!!!!!!

Conclusion:  when using most datatypes to pick values from a sorted
block (within the length of the block), it is true that

(to-integer pos-1) < (to-integer pos-2)

will guarantee that

(pick s-blk pos-1) < (pick s-blk pos-2)

when we are allowed to pick directly, and will guarantee

(pick s-blk to-integer pos-1) < (pick s-blk to-integer pos-2)

when we must make the conversion explicit.

This is NOT the case with logic! values, hence my observation that
this is an example of where one must simply memorize an exception
to a general rule.

It is certainly possible to respond by saying "Well, memorize the
exceptions then!"

The more exceptions one must memorize, the greater the difficulty
of using the language and the greater the likelihood of error.

-jn-
```