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

Rebol Crash Was Mutability and sameness - a puzzle

 [1/8] from: rotenca:telvia:it at: 17-Jul-2001 14:02


1) What is the answer to the puzzle? 2) About sameness I have found this thing on Rebol / Windows 98: a: [1] ; == [1] insert a reduce [a] ;== [1] b: [1] ;== [1] insert b reduce [b] ;== [1] same? a a/1 ;== true same? b b/1 ;== true All OK, now: same? a b ; **** Rebol makes a Guru Meditation (the name for old Amiga crash) romano paolo tenca ----------------- Da: "Ladislav Mecir" <[lmecir--mbox--vol--cz]> Oggetto: [REBOL] Mutability and sameness - a puzzle

 [2/8] from: zyao::sitaranetworks::com at: 17-Jul-2001 13:13


On Tue, Jul 17, 2001 at 02:02:49PM +0200, Romano Paolo Tenca wrote:
> 1) What is the answer to the puzzle? > 2) About sameness I have found this thing on Rebol / Windows 98:
<<quoted lines omitted: 6>>
> All OK, now: > same? a b ; **** Rebol makes a Guru Meditation (the name for old Amiga crash)
how about insert a reduce [copy a] may not be what your looking for, cause a definitely different from a/1 and all [ a = b not same? a b ] did that on freebsd -z

 [3/8] from: holger:rebol at: 17-Jul-2001 10:26


On Tue, Jul 17, 2001 at 02:02:49PM +0200, Romano Paolo Tenca wrote:
> All OK, now: > > same? a b ; **** Rebol makes a Guru Meditation (the name for old Amiga crash)
Please report this to [feedback--rebol--com] -- Holger Kruse [holger--rebol--com]

 [4/8] from: rotenca:telvia:it at: 17-Jul-2001 20:10


Done! romano -----Messaggio Originale----- Da: "Holger Kruse" <[holger--rebol--com]> A: <[rebol-list--rebol--com]> Data invio: 17 lug 2001 19:26 Oggetto: [REBOL] Re: Rebol Crash Was Mutability and sameness - a puzzle

 [5/8] from: rotenca:telvia:it at: 17-Jul-2001 20:06


> how about > insert a reduce [copy a] > > may not be what your looking for, cause a definitely different from a/1 > and all [ a = b not same? a b ] > > did that on freebsd
Thank you, but i'm trying to do deep copy of reflexive block/objects and want to compare different reflexive objects. romano

 [6/8] from: lmecir:mbox:vol:cz at: 18-Jul-2001 12:54


Hi,
> 1) What is the answer to the puzzle?
In http://www.sweb.cz/LMecir/evaluation.html I wrote a function like: mut-equal?: function [ { a mutation discernibility test, should discern SERIES! values } a [series!] b [series!] ] [result] [ if not equal? length? :a length? :b [ return false ] ; perform a temporary mutation insert tail :a #"1" result: equal? length? :a length? :b ; perform the reverse mutation remove back tail :a result ] to use it instead of SAME? for SERIES! values, because SAME? crashes Rebol. BTW, I reported the crash to feedback on 23 July 2000 and received the tick #3509. If I try it for the given example, I get: a: [1] ; == [1] insert a reduce [a] ;== [1] b: [1] ;== [1] insert b reduce [b] ;== [1] mut-equal? a a/1 ;== true mut-equal? b b/1 ;== true mut-equal? a b ; == false This looks like the way how the SAME? function should have worked. The problem is, that there is still one case, where it doesn't produce a result we would want to get. See this: a: [1] b: tail a remove a length? b ; ** Script Error: Out of range or past end ; ** Where: halt-view ; ** Near: length? b same? b b ; ** Script Error: Out of range or past end ; ** Where: halt-view ; ** Near: same? b b mut-equal? b b ; ** Script Error: Out of range or past end ; ** Where: mut-equal? ; ** Near: if not equal? length? :a For the MUT-EQUAL? function to work more satisfactorily we need a better LENGTH? function. Here is my trial: indexz?: function [ series [series!] ] [orig-tail result] [ orig-tail: tail :series while [ error? try [result: (index? :series) - 1] ] [ if empty? head :series [ append :series #"1" ] append :series head :series ] clear :orig-tail result ] lengthz?: func [ series [series!] ] [ (indexz? tail :series) - (indexz? :series) ] now we can redefinne MUT-EQUAL? to use LENGTHZ? instead of LENGTH? and the results are: mut-equal?: function [ { a mutation discernibility test, should discern SERIES! values } a [series!] b [series!] ] [result] [ if not equal? lengthz? :a lengthz? :b [ return false ] ; perform a temporary mutation insert tail :a 1 result: equal? lengthz? :a lengthz? :b ; perform the reverse mutation remove back tail :a result ] a: [1] ; == [1] insert a reduce [a] ;== [1] b: [1] ;== [1] insert b reduce [b] ;== [1] mut-equal? a a/1 ;== true mut-equal? b b/1 ;== true mut-equal? a b ; == false a: [1] b: tail a remove a lengthz? b ; == -1 mut-equal? b b ; == true Regards Ladislav

 [7/8] from: rotenca:telvia:it at: 19-Jul-2001 2:52


"Ladislav Mecir" <[lmecir--mbox--vol--cz]>
> For the MUT-EQUAL? function to work more satisfactorily we need a better > LENGTH? function. Here is my trial:
<<quoted lines omitted: 13>>
> result > ]
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. 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. 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 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. I liked your articles very much.
> Regards > Ladislav
ciao romano

 [8/8] from: rotenca:telvia:it at: 22-Jul-2001 1:07


Mecir:
> to use it instead of SAME? for SERIES! values, because SAME? crashes Rebol. > BTW, I reported the crash to feedback on 23 July 2000 and received the tick > #3509. If I try it for the given example, I get:
Now i see than my problem with same? is exactly the "same" of your text Identity... only you use /only and I reduce... ciao romano

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted