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

[REBOL] Re: Trimming values from a series?

From: edanaii:cox at: 24-Jul-2002 19:47

Carl Read wrote:
>On 25-Jul-02, Ed Dana wrote: > >>>Hmmm. Are there cases where unique can change the order, as well as >>>stripping out duplicates? >>> > >>I would expect that UNIQUE first sorts the data in order to trim out >>the duplicates. It's the most efficient way to find and remove them. >>Which is why I went looking for it in SORT first. >> > >>I doubt that issuing SORT and UNIQUE in any combination is faster >>because of the redundancy. >> > >>I could be wrong, though... >> > >I think you are. Unique is much faster than sort, at least on Amiga. >Umm, well, at least on the block of 1s and 2s in a block I've just >tried. (: This suggests unique doesn't use sort, or at least not the >sort available to us. >
I probably am. :) Sorting this string, for example, produces the following results:
>> UNIQUE "Now is the time for all good men to come to the aid of their
country" == "Now isthemfralgdcuy" Which suggests that either UNIQUE uses some other algorithm, or it sorts it and then puts it back to its original form. The latter, would be very inefficient, of course, so I vote for the former. Maybe the algorithm is something similar to what's used for some compression schemes? Just a thought... -- Sincerely, | Ed Dana | Courage is fear holding on a minute longer. Software Developer | -- General George S. Patton 1Ghz Athlon Amiga |