When designing a sorting API, the comparison function should always be a parameter. The default case is less useful than a casual glance might suggest.
When designing a sorting API, the comparison function should always be a parameter. The default case is less useful than a casual glance might suggest.
Mars Saxman
2006: January February March April May June July August September October November December
2005: January February March April May June July August September October November December
2004: January February March April May June July August September October November December
Wanderings in Black and Red (previous site)
I agree; even for string sorts it’s not so clear what the default case should be. But should the algorithm also be configurable?
Comment by charles — July 7, 2008 @ 8:49 am
Isn’t the algorithm the thing that one configures, by supplying a list and a comparator? I can’t think of any other components involved.
Comment by Mars Saxman — July 8, 2008 @ 6:34 pm
Within seconds after commenting, the silliness of the second sentence became clear. I was referring to the sorting algorithm itself. For a library function, though, it’s most likely that the choices would be limited to stable v. unstable, and that decision would be made in the course of writing code.
Comment by charles — July 10, 2008 @ 6:48 am