On 07/17/2013 02:42 PM, bearophile wrote: > You need a lambda delegate for that. But I forgot about multisort algorithm... > It's probably the right tool.
So, in the end I tried out 3 different alternatives: schwartzSort(a => tuple(arr1[a], arr2[a]), "a < b") sort((a, b) => arr1[a] < arr1[b] || (arr1[a] == arr1[b] && arr2[a] < arr2[b])) multiSort((a, b) => arr1[a] < arr1[b], (a, b) => arr2[a] < arr2[b]) sort() seems faster than schwartzSort for smaller-scale stuff, but takes longer for larger-scale sorts. multiSort wins out over both of them. I guess in principle it might be possible to have a multiSchwartzSort which allows for multiple transformations: multiSchwartzSort(a => arr1[a], a => arr2[a], "a < b", "a < b") ... which might gain some speed by caching the results of the transformations, as schwartzSort is supposed to do? But anyway, I think this solution works at limited extra cost speed-wise. :-) Thanks very much to both of you!
