[REBOL] Mutability and sameness - a new puzzle
From: lmecir:mbox:vol:cz at: 20-Jul-2001 16:33
Hi Romano,
> > For the MUT-EQUAL? function to work more satisfactorily we need a better
> > LENGTH? function.
...snip...
> Why not:
>
> indexz2?: func [series [series!] /local result][
> if error? try [result: -1 + index? :series ] [
> result: index? tail head :series
> ]
> result
> ]
>
> I think that "tail series" should be always the same: a relative position
not
> an absolute one.
> Tail should be always the end. When you remove an item, tail should
> dinamically change. So a and b in this case should be(come) the same.
Yes, the INDEXZ2? function surely has got its merits, but it didn't solve my
problem below.
I proposed 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
indiscernible, i.e., if they are equivalent for every purpose (for
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 think that could be util a function to discern if data adressed by
series
> share the same memory. In this case a and b share memory (you can do "tail
> head b" to prove). Same? like mut-equal? makes a difference between series
at
> different position.
What you have in mind is probably something like series independency
represented by the INDEPENDENT? function you can find in
http://www.rebolforces.com/articles/series.html . That differs from
indiscernibility, because the blocks like:
a: [1 2]
b: next a
surely are discernible, but they aren't independent.
> About discernibility i don't understand a thing: if you think of it as
total
> indiscernibility (like Leibniz), so a <> b because "root" are different,
or
> data indiscernibility, so a word and a path or two different word can be
the
> "same" only because they address the same memory data.
I defined what "Rebol indiscernibility" means to me in
http://www.sweb.cz/LMecir/evaluation.html
The definition is a little bit technical, but it is understandable, I think.
I would say, that it is a Leibnitz-like definition. There may be a different
POV, of course, but the definition I proposed is a result of my search for a
definition that would be as exact and natural as possible (any other
takers?).
I have stolen the main ideas from Joel Neely during the discussion. Thanks,
Joel.
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
.
> I think that if two item of Rebol were totally indiscernibles, we could
not
> ask if they are the same, because we could not discern them.
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.
> I liked your articles very much.
I am honored.
> > Regards
> > Ladislav
>
> ciao
> romano
>
New puzzle:
Define a function RECURSIVE? able to find out, if a Rebol block is
recursive.