[REBOL] R: Mutability and sameness - a new puzzle
From: rotenca:telvia:it at: 22-Jul-2001 0:30
Mecir has written some time ago:
> I propose the INDEXZ? function to be able to discern some block values,
> that are discernible. I shall give you an example so that we may discuss our
> POV's. Let's have:
>
> a: tail [1 2]
> b: back a
> clear head a
> I defined the meaning of Identity: two values are the same, if they are
> interested: the exact definition is in
> http://www.sweb.cz/LMecir/evaluation.html). This definition is quite useful,
> simple and natural. If I use it for the above A and B, I will find out, that
> A and B are discernible (by the version of the MUT-EQUAL? function using
> LENGTHZ? function). That is why I see, that they aren't identical.
I've understood. An index, being an absolute position, remains in
memory also if the index is past the end of serie. When the serie is filled
up to the index, the index of the serie return to be valid. The only method to
preserve the index embedded and distingue "a" from "b" is filling the
series, like in your routine. Skip, back, next do not help because they all
give
an error.
However, in the Rebol context, the value of b, when "a" is clear, is an error,
which is not a bug, but a feature (I think). So your method of retrieving the
index of b with lenghtz? goes beyond the actual Rebol implementation.
When a is clear, b at position 3 and c (=a) at position 100 give the same
result: an error and therefore their values are indiscernibles.
To discern them you must change their value! So I think that "b"
(with index 3) and "c" (with index 100) are discernibles only if their value
is not what actually it is (a clear series). The actual value is an error for
both. You can't discern the difference between two values, changing them.
This lead only to an "ipotetical difference": if values of "a" and "b" were
x
then...
Index, indeed, is not a propriety of values but a propriety of words. In this
case, clearing "a" hides this propriety and makes it indifferent to the
get function (it is indifferent for get if a word is 3 o 100 places after
tail).
Another thing: if you make a different binding, two word which have the same
value can result in different value. Therefore, as you see, I can distingue
two words with the same value by binding one of them to another context.
And binding does not change the initial value, as one can see with a dependent
word. So if we try to define all the ipotetical values of a word, we must keep
in care
all the binding (one for every object - could be a fun routine).
Therefore, i think you should introduce the concept of binding and the concept
of
object before speaking of indiscernibility.
Your text:
>Observation # 1: Two Rebol values A and B are identical, if for every
equivalence EQ the expression >(eq get/any 'a get/any 'b) yields TRUE. In
different words: two Rebol values are identical, if they are >equivalent for
every purpose
Now see this a little strange EQ text which try to respect your spec of EQ:
a: 4
o: context [a: 3]
same? get/any 'a get/any 'a ;=true
same? reduce bind [get/any 'a] in o 'a reduce bind [get/any 'a]
'system;=false
The value of a is not identical to value of a. :-)
I see another little problem, about path:
same? get/any 'a get/any 'system/words/a
gives an error. Perhaps, you should speak only of words or extend the
definition to include path. Object path is also an indirect form of binding.
> What you have in mind is probably something like series independence
> represented by the INDEPENDENT? function you can find in
Yes, you are right.
> The raison d' etre of the definition lies in the fact, that the SAME?
> function is provably buggy (Rebol crashes, errors, no results for some
> values,...) as well as its description. That is why I was interested, if
> there is any "Rebol natural
> identity", and how shall it look like. I am pretty satisfied with the result
> I obtained: There is exactly one natural identity in Rebol and it can be
> defined as a Rebol function, although it shall differ from the SAME?
> function. Moreover, the Rebol Identity can be defined and described in Rebol
> terms without need to use Rebol unfriendly (and wrong) terminology, like
> "memory address".
Trying a very initial definition of mine, more semantic than sintax oriented,
I should say:
Two Words have the same meaning (value) if the Vocabularies (context)
used by the Interpreter for that words, associate (get) them to the same data.
Many things should be cleared: first of all: "same data".
> That is an error, I think. We can always ask questions like: "Are 1 and 1
> indiscernible values?" as well as: "Are 1 and 2 indiscernible values?". The
> question is meaningful regardless of the fact, if the answer is positive or
> negative.
Nobody can discern what is indiscernible, as Leibniz teaches, the question:
Are 1 and 1 indiscernible values?
discern the two "1" with the expression
itself: the two "1", in fact, have different position in the statement, so
you,
and I, can discern them and the question is meaningful.
I asked you at the beginning if you take in consideration the "literal" or
lexical
layer to define indiscernibility...
> Regards
> Ladislav
> New puzzle:
>
> Define a function RECURSIVE? able to find out, if a Rebol block is
> recursive.
I'll have seen your new routines. I'll study them asap!
ciao
romano