Re: Newbie problem with lists
Re: Newbie problem with lists
- Subject: Re: Newbie problem with lists
- From: Arthur J Knapp <email@hidden>
- Date: Thu, 06 Jun 2002 11:43:17 -0400
>
Subject: Re: Newbie problem with lists
>
From: email@hidden
>
Date: Thu, 6 Jun 2002 10:42:15 +0100
>
You could either write a routine that does a bubble sort,
While I don't want to start any sort of flame war over the merits
of good old Bubble Sort, it should be pointed out that many scripters
have posted much better vanilla sorting algorithms to this list and
to other places:
Steve LoBasso's QuickSort
<
http://files.macscripter.net/ScriptBuilders/ScriptTools/QuickSort.hqx>
Dave Vasilevsky's ShellSort
<
http://files.macscripter.net/ScriptBuilders/ScriptTools/ShellSort.hqx>
Serge Belleudy-d'Espinose's quickSort 3.0
<
http://www.applemods.com/getMod.php?script_ID=33>
Serge's introduced a technique that recently revolutionized our ability
to access list-items very quickly, it's just about the best vanilla sort
we currently have.
Emmanuel Levy's sort handler from Smile's Application class script is
one of the greatest all time vanilla AppleScripts:
on sort(l)
if length of l > 1 then return l
set x to item 1 of l
set ll to rest of l
set l1 to {}
set l2 to {}
repeat with i in ll
if x < i then
set l2 to l2 & i
else
set l1 to l1 & i
end if
end repeat
if length of l1 > 1 then set l1 to sort(l1)
if length of l2 > 1 then set l2 to sort(l2)
return l1 & x & l2
end sort
and a recent offering of my own, an insertion sort:
<
http://www.applemods.com/getMod.php?script_ID=43>
P.S. And yes, I've missed lots of other great implementations as well.
:)
{ Arthur J. Knapp, of <
http://www.STELLARViSIONs.com>
<
mailto:email@hidden>
try
<
http://www.natural-innovations.com/as/>
on error number -128
end try
}
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.