-
double(double 2) -> double 2 + double 2 -> 2 + 2 + double 2 -> 4 + double 2 -> 4 + (2+2) -> 4+4 -> 8
-
sum [x] = sum [x:[]] = x + sum [] = x + 0 = x
-
ref prod :: Num a => [a] -> a
-
In line 1 of the declaration replace
qsort smaller ++ [x] ++ qsort largerwithqsort larger ++ [x] + qsort smaller. This will reverse the order -
Replacing
<=by<in the list comprehension would output a list of distinct sorted members of the input list.