[Haskell-cafe] List as input

leledumbo leledumbo_cool at yahoo.co.id
Thu Oct 16 00:53:12 EDT 2008


> 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?

> 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.



More information about the Haskell-Cafe mailing list