KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Why might the C# language designers not have included support for something like this (ported from Structure and Interpretation of Computer Programs , second ed., p. 30): /// <summary>Return the square root of x.</summary> double sqrt(double x) { bool goodEnough(double guess) { return Math.Abs(square(guess) - x) < 0.001; } double improve(double guess) { return average(guess, x / guess); } double sqrtIter(double guess) { return goodEnough(guess) ? guess : sqrtIter(improve(guess)); } sqrtIter(1.0); }
Tags (comma-separated)
Save Edits
Cancel