improve-guess(Guess, Value, NewGuess) :- NewGuess is (Guess + (Value/Guess))/2 .
guess-root(Value, Guess, Result) :-
good-enough(Guess, Value) -> Result is Guess;
improve-guess(Guess, Value, NewGuess),
guess-root(Value, NewGuess, Result).
sqrt(X, Y) :- guess-root(X, 1, Y).
Name:
Anonymous2008-09-10 12:14
>>10
Don't be threatened by Haskell's superiority, nigger. Just accept your little pet language, whatever it is, is shit next to Haskell, and make the switch.