<div dir="auto">One approach <div dir="auto"><br></div><div dir="auto">One function to compute the next iterate</div><div dir="auto"><br></div><div dir="auto">Another function to call the computation function until results are within some tolerance </div><div dir="auto"><br></div><div dir="auto">It's usually presented as separation of control and computation 😎<br><br><div data-smartmail="gmail_signature" dir="auto">--<br>Sent from an expensive device which will be obsolete in a few months<br>Casey</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sep 3, 2017 1:23 AM, "mike h" <<a href="mailto:mike_k_houghton@yahoo.co.uk">mike_k_houghton@yahoo.co.uk</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi,<div><br></div><div>To help me in learning Haskell I started blogging about some of the things I’ve looked at. </div><div>One such topic was calculating square roots ‘by hand’ and then deriving a Haskell algorithm. </div><div>I wrote about the well known  technique here</div><div><a href="http://gitcommit.co.uk/2017/08/25/the-root-of-the-problem-part-1/" target="_blank">http://gitcommit.co.uk/2017/<wbr>08/25/the-root-of-the-problem-<wbr>part-1/</a></div><div><br></div><div>and it it is really quite a simple method. </div><div><br></div><div>The second part of the post will be an implementation in Haskell. </div><div><br></div><div>I then tried implementing it  and got something that works but really its not very pleasant to look at! And its something I don’t want to post! Some parts are fine but I think I locked myself into the notion that it had to be using State and  really the end result is pretty poor. </div><div><br></div><div>I know this i perhaps a ‘big ask’ but I’d really appreciate any suggestions, solutions, hints etc. I will of course give full attribution. </div><div><br></div><div>I’ve created a gist of the code here</div><div><a href="https://gist.github.com/banditpig" target="_blank">https://gist.github.com/<wbr>banditpig</a></div><div><br></div><div>Many Thanks</div><div><br></div><div>Mike</div></div><br>______________________________<wbr>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/beginners</a><br>
<br></blockquote></div></div>