
1 Apr
2011
1 Apr
'11
3:52 a.m.
Am 31.03.2011 17:55, schrieb blackcat@pro-ns.net:
Hi,
I was hoping to get a code critique from some experienced Haskell people. I put my code up in this blog post: http://learnmeahaskell.blogspot.com/2011/03/playing-around-with-quickcheck.h... .
Without trying to understand your code I'm disturbed by a) duplicate code in factors' namely x `mod` y == 0 && y*y ... factors' x (y+1) b) "sort $ nub" (even twice) first sort and then removing duplicates can be more efficient, I would suggest: "Data.Set.toList . Data.Set.fromList" c) using (head xs) and (tail xs) in "check" (without "null xs" test) looks suspicious. Use pattern matching on xs (instead of on number y)! HTH Christian
thanks Lee