
27 Mar
2009
27 Mar
'09
11:28 a.m.
On Fri, 27 Mar 2009, Brent Yorgey wrote:
thing n = n + fromIntegral (round (sqrt n))
thing :: Floating a => a -> a
thing n = n + round (sqrt (fromIntegral n))
thing :: Integral a => a -> a That is, the return types of the method are different?
Pop quiz for beginners: both of these solve the original problem, but they are not quite the same. What is the difference? (Do not answer this question if you are not a beginner!)