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

[REBOL] Re: ticket #6863

From: lmecir::mbox::vol::cz at: 24-Jul-2001 5:50

Hi,
> This approach has one major problem. Your mut-equal? function has the > side effect that is may cause a re-allocation for the series because > it adds a value to it. >
You are right. This version tries to modify the series only in "special cases", while getting the correct result: 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 ] mut-equal?: func [ { a discernibility test, useful to discern SERIES! values } a [series!] b [series!] ] [ found? all [ same? tail :a tail :b equal? indexz? :a indexz? :b ] ] a: [1] insert a reduce [a] b: [1] insert b reduce [b] mut-equal? a a/1 ; == true mut-equal? b b/1 ; == true mut-equal? a b ; == false a: [1] b: tail a remove a mut-equal? b b ; == true Trying to use the SAME? function instead of the MUT-EQUAL? function reveals the bugs of SAME?. Regards Ladislav