
On Wed, Oct 15, 2008 at 9:53 PM, leledumbo
The compiler doesn't know what kind of list you are trying to read, sort, and print.
So, the type must be specific? Then why it's possible to call the sorting function with any list?
It isn't. The type of data in the list must be able to be compared. See the type signature for Data.List.sort Data.List.sort :: (Ord a) => [a] -> [a] So "any" list may be sorted if the items in the list are of Ord.
I'm curious as to why taking the pivot from the middle is an 'optimized' version.
Consider if it's used in a GUI program which calls the function when a button is pressed. Often, users clicks the button more than once. If the pivot is the first (or last) element, the second (and further) click will cause worst case scenario to happen. OTOH, if the pivot is the middle element, best case scenario will happen.
-- View this message in context: http://www.nabble.com/List-as-input-tp19987726p20007078.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe