
2 Mar
2008
2 Mar
'08
12:17 p.m.
Albert Y. C. Lai wrote:
Note the code of "merge":
merge cmp xs [] = xs merge cmp [] ys = ys merge cmp (x:xs) (y:ys) = ...
Suppose you re-order the first two lines, i.e., make it
merge cmp [] ys = ys merge cmp xs [] = xs merge cmp (x:xs) (y:ys) = ...
what will happen?
Oh, so the mergesort in the library doesn't behave as nicely as I'd have expected. I'd consider the first definition a strictness bug; the general etiquette is to force arguments from left to right. Regards, apfelmus