[Haskell-cafe] Set of reals...?

Ben Rudiak-Gould Benjamin.Rudiak-Gould at cl.cam.ac.uk
Fri Oct 29 08:18:27 EDT 2004


MR K P SCHUPKE wrote:

 >>     | otherwise = contractSet (contract x0 y0:xs) ys
 >
 >I think you'll find the original is correct. The first two cases deal with
 >non-overlapping ranges. The only remaining case is overlapping ranges,
 >(partial and full overlap) both these cases are dealt with by contract,
 >and as a result use up both the ranges at the head of both lists, sdo
 >the merged range is prepended to the output list and the tail is
 >calculated by passing the unused tails of both lists to contactSet...

Consider the case of merging [(1,2),(3,4)] and [(1,4)]. I think your 
function will produce an answer of [(1,4),(3,4)].

-- Ben



More information about the Haskell-Cafe mailing list