A bug in IntMap

Daan Leijen daan at cs.uu.nl
Wed Jul 6 23:05:06 EDT 2005


Scott Turner wrote:
> The bug is right there in split.  Data/IntMap.hs needs:

Ha, great that you found it so fast!

Thanks a lot,
-- Daan Leijen.


> 
> ***************
> *** 750,755 ****
> --- 750,756 ----
>   split k t
>     = case t of
>         Bin p m l r
> +       | nomatch k p m -> if k>p then (t,Nil) else (Nil,t)
>           | zero k m  -> let (lt,gt) = split k l in (lt,union gt r)
>           | otherwise -> let (lt,gt) = split k r in (union l lt,gt)
>         Tip ky y
> ***************
> *** 764,769 ****
> --- 765,771 ----
>   splitLookup k t
>     = case t of
>         Bin p m l r
> +       | nomatch k p m -> if k>p then (t,Nothing,Nil) else (Nil,Nothing,t)
>           | zero k m  -> let (lt,found,gt) = splitLookup k l in 
> (lt,found,union gt r)
>           | otherwise -> let (lt,found,gt) = splitLookup k r in (union l 
> lt,found,gt)
>         Tip ky y
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries



More information about the Libraries mailing list