let improve x guess = (guess + x/guess)/2.0 let goodEnough x guess = abs (x-guess*guess)/x < 0.00001 let sqrtGuesses x = 1:(map (improve x) (sqrtGuesses x)) let sqrt' x = head (dropWhile (not . (goodEnough x)) (sqrtGuesses x)) sqrt' 10