Denna delen av 99 uppdateras inte längre utan har arkiverats inför framtiden som ett museum. Här kan du läsa mer om varför.
Mac-nyheter hittar du på Macradion.com och forumet hittar du via Applebubblan.
set listan to {9, 3, 5, 6, 7}
my Integer_Sort(listan)
on Integer_Sort(my_list)
set the index_list to {}
set the sorted_list to {}
repeat (the number of items in my_list) times
set the low_item to ""
repeat with i from 1 to (number of items in my_list)
if i is not in the index_list then
set this_item to item i of my_list as integer
if the low_item is "" then
set the low_item to this_item
set the low_item_index to i
else if this_item < low_item then
set the low_item to this_item
set the low_item_index to i
end if
end if
end repeat
set the end of sorted_list to the low_item
set the end of the index_list to the low_item_index
end repeat
return the sorted_list
end Integer_Sort
Det t.o.m rundar av en float som sorteras korrekt.
set this_list to {9, 3, 5, 10, 7}
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
set sorted_list to (sort(this_list))
return sorted_list