Sigh. My system insists on rewriting outgoing mail headers, and ghc-users refuses non-subscribers to post there. I'm too tired to fight this at the moment, so I'll send it here in the hope that it will be picked up by the right adressee. -k -------- Original Message -------- Subject: Bug in Data.IntSet? Date: Thu, 27 Oct 2005 15:25:30 +0200 From: Ketil Malde <ketil@ii.uib.no> To: glasgow-haskell-users <glasgow-haskell-users@haskell.org> AFAICT, there is a bug in Data.IntSet.split Here's an excerpt from GHCi: *Main> let m=482 in Data.IntSet.split (16*m) $ Data.IntSet.fromList (List.map (m*) [17,18,19,30,40]) ({8194,8676,9158},{14460,19280}) *Main> let m=481 in Data.IntSet.split (16*m) $ Data.IntSet.fromList (List.map (m*) [17,18,19,30,40]) ({},{8177,8658,9139,14430,19240}) *Main> let m=481 in Data.Set.split (16*m) $ Data.Set.fromList (List.map (m*) [17,18,19,30,40]) ({},{8177,8658,9139,14430,19240}) *Main> let m=482 in Data.Set.split (16*m) $ Data.Set.fromList (List.map (m*) [17,18,19,30,40]) ({},{8194,8676,9158,14460,19280}) *Main> let m=482 in Data.Set.split (16*m) $ Data.Set.fromList (List.map (m*) [17,18,19,30,40]::[Int]) ({},{8194,8676,9158,14460,19280}) % ghci --version The Glorious Glasgow Haskell Compilation System, version 6.4.1 -k
On 27-okt-2005, at 15:30, Ketil Malde wrote:
Sigh. My system insists on rewriting outgoing mail headers, and ghc-users refuses non-subscribers to post there. I'm too tired to fight this at the moment, so I'll send it here in the hope that it will be picked up by the right adressee.
BTW: I sent a mail to libraries with the attached patch that fixes this behaviour. Note that the problem lies in split not checking to see if the prefix of the number being split on is present in the tree. The patch also fixes the behaviour on negative numbers, by the way. Oh, and smaller testcases:
Data.IntSet.split 2 $ Data.IntSet.fromList [0,1] Data.IntSet.split 2 $ Data.IntSet.fromList [4,6,8] Data.IntSet.split 1 $ Data.IntSet.fromList [0,-1]
Doei, Arthur. (Who figured this out together with Bertram Felgenhauer) -- /\ / | arthurvl@cs.uu.nl | Work like you don't need the money /__\ / | A friend is someone with whom | Love like you have never been hurt / \/__ | you can dare to be yourself | Dance like there's nobody watching
Thanks, I'll apply ASAP. Cheers, JP. On 10/28/05, Arthur van Leeuwen <arthurvl@cs.uu.nl> wrote:
On 27-okt-2005, at 15:30, Ketil Malde wrote:
Sigh. My system insists on rewriting outgoing mail headers, and ghc-users refuses non-subscribers to post there. I'm too tired to fight this at the moment, so I'll send it here in the hope that it will be picked up by the right adressee.
BTW: I sent a mail to libraries with the attached patch that fixes this behaviour. Note that the problem lies in split not checking to see if the prefix of the number being split on is present in the tree. The patch also fixes the behaviour on negative numbers, by the way.
Oh, and smaller testcases:
Data.IntSet.split 2 $ Data.IntSet.fromList [0,1] Data.IntSet.split 2 $ Data.IntSet.fromList [4,6,8] Data.IntSet.split 1 $ Data.IntSet.fromList [0,-1]
Doei, Arthur. (Who figured this out together with Bertram Felgenhauer)
-- /\ / | arthurvl@cs.uu.nl | Work like you don't need the money /__\ / | A friend is someone with whom | Love like you have never been hurt / \/__ | you can dare to be yourself | Dance like there's nobody watching
_______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
participants (3)
-
Arthur van Leeuwen -
Jean-Philippe Bernardy -
Ketil Malde