Thanks, Robert, but this method, with GetItem and SetItem, involves reading the complete entries out of the list and then writing them back in at a different position, which is very slow. I was hoping for a method that simply swapped the StrList.items, which are apparently pointers to the list entries, leaving the entries themselves in place, which would obviously be much faster. Unfortunately these are not accessible from outside the Dialog module. My list is currently up to about 33,000 entries. So an external bubble sort works, acceptably fast on a small test list, but with the full 33,000 and the bubble sort's n^2 time, the polar icecap is melting faster. I guess next I'll try to implement a QuickSort. Thanks anyway,
Steve Troy in Maryland USA
-------- Original Message --------
Subject: Re: [BLACKBOX] Sorting a Dialog.List
From: Robert <robert.campbell_{([at]})nowhere.xy
Date: Thu, September 06, 2012 6:03 pm
To: BLACKBOX{([at]})nowhere.xy
Stephen
The following routine (from LibMisc on CPC
http://www.zinnamturm.eu/downloadsIN.htm#Lib) is a 'clunky' way of solving a different
problem, but it might give you some ideas.
The Docu & Mod extracts are:
I would guess that your lists are fairly short, so a simple Bubble sort would be fine?
Cheers
Robert.
On 06/09/2012 21:40, Stephen R. Troy wrote:
Dear List, another newbie question: is there a non-clunky way to sort the items in a Dialog.List object? I'm nervous about going inside the Dialog module, and apparently the individual "items" in the List are not accessible from outside the Dialog module. Hint, hint: it sure would be swell if a new release included such a Sort method. Obviously I could do my sorting before entering the items into the list, but for various reasons this would be clumsy. Any suggestions appreciated.
Steve Troy in Maryland USA
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2197 / Virus Database: 2437/5252 - Release Date: 09/06/12
---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
Thanks, Robert, but this method, with GetItem and SetItem, involves reading the complete entries out of the list and then writing them back in at a different position, which is very slow. I was hoping for a method that simply swapped the StrList.items, which are apparently pointers to the list entries, leaving the entries themselves in place, which would obviously be much faster. Unfortunately these are not accessible from outside the Dialog module. My list is currently up to about 33,000 entries. So an external bubble sort works, acceptably fast on a small test list, but with the full 33,000 and the bubble sort's n^2 time, the polar icecap is melting faster. I guess next I'll try to implement a QuickSort. Thanks anyway,
Steve Troy in Maryland USA
---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to
----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
Received on Fri Sep 07 2012 - 17:34:23 UTC