Hello Stephen, Monday, December 7, 2009, 8:11:01 PM, you wrote:
it's just what goupBy compares with the first element of group rather than comparing two adjancent elements. look at the trace it's not a bug, but misunderstanding of specification :) > Could it not be a bug in > a) printf > b) unsafePerformIO c) >>> > d) return > e) <= > f) show > g) GHC or GHCi? > All of the above? > Best wishes > Stephen > 2009/12/7 L.Guo <[email protected]>: >> Hi there: >> >> My friend asked me a question, and i suppose he has found a bug of `groupBy'. >> >> Here is the code piece: >> >>> List.groupBy (\a b -> Foreign.unsafePerformIO (Text.Printf.printf "\t%d <= >>> %d ?: %s\n" a b (show (a<=b)) >> return (a<=b))) [7,3,5,9,6,8,3,5,4] >> >> I have tested it in GHC 6.10.4 (Win XP) and GHC 6.8.3 (Linux), both give the >> wrong result (categaried): >> >> 7 <= 3 ?: False >> 3 <= 5 ?: True >> 3 <= 9 ?: True >> 3 <= 6 ?: True >> 3 <= 8 ?: True >> 3 <= 3 ?: True >> 3 <= 5 ?: True >> 3 <= 4 ?: True >> [[7],[3,5,9,6,8,3,5,4]] >> >> >> Regards >> -------------- >> L.Guo >> 2009-12-08 >> >> _______________________________________________ >> Haskell-Cafe mailing list >> [email protected] >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > _______________________________________________ > Haskell-Cafe mailing list > [email protected] > http://www.haskell.org/mailman/listinfo/haskell-cafe -- Best regards, Bulat mailto:[email protected] _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
