I agree that the description of isort() given by its authors is less than crystal clear.
keyproc() does not perform a comparison as in other languages' sort functions. keyproc() takes one item (often a structure type for which the built-in comparator would not do much) and returns a value of any type (often an integer or string) that is representative of that item. keyproc() is called on each item to be sorted, and then the keys are sorted and the items returned in a list that was sorted using the keys. isort() can be called with another argument after the keyproc(), and if that argument is supplied it is an extra parameter passed into keyproc() each time to govern its behavior of extracting the key from the element. There is lying around the Icon/Unicon bitosphere a more traditional quicksort implementation that uses a comparator function, but isort works well. Thanks to your question about it, I have updated the Unicon book appendix description of isort() and committed that change to SVN (it will go onto the website next time I get a chance to update the PDF there). Clint ________________________________________ From: John Sampson <jrs....@ntlworld.com> Sent: Wednesday, September 18, 2013 4:46 AM To: Unicon group Subject: [Unicon-group] Custom sorting I am interested in the idea of sorting a list of complex codes such as "23:45" I would want to sort on the first number, then on the second. I assume that "isort" does something of this kind but I don't understand the textbook on this. Should "keyproc" be a procedure taking two items and returning "1", "0" or "-1" depending on whether the first parameter is greater, equivalent or less than the second? Or should it take one item and return an integer representing the input's value? What is meant by "the second argument is isort's argument y"? Regards John Sampson ------------------------------------------------------------------------------ LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk _______________________________________________ Unicon-group mailing list Unicon-group@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/unicon-group ------------------------------------------------------------------------------ LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk _______________________________________________ Unicon-group mailing list Unicon-group@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/unicon-group