[REBOL] Re: new puzzle on sameness 2
From: rotenca::telvia::it at: 13-Feb-2003 22:07
This puzzle is a little more hard. It uses identical? of Ladislav, but same?
should works.
This puzzle demonstrate that i can use the native Change to change an integer
value without changing all the identical integer, only another one.
Two quotes to start:
Two Rebol values are identical, if they are equivalent for every purpose.
(L)
Two mutable values are identical if they have equal state and every mutation
affects them simultaneously.
(L)
The puzzle (console trascription)
>> x/a: 1
== 1
>> integer? x/a
== true
>> x/copy-of-a: x/a
== 1
>> x/same-as-a: x/a
== 1
>> identical? x/a x/copy-of-a
== true
>> identical? x/a x/same-as-a
== true
>> identical? x/copy-of-a x/same-as-a
== true
>> ; Change is the true change action!
>> action? :change
== true
>> change magic zero
== ;RESULT DELETED --- else too easy :-)
>> x/a
== 0
>> x/copy-of-a
== 1
>> x/same-as-a
== 0
>> identical? x/a x/copy-of-a
== false
>> identical? x/a x/same-as-a
== true
>> identical? x/copy-of-a x/same-as-a
== false
---
Ciao
Romano