Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  Square root algorithm (yi lu)
   2. Re:  Square root algorithm (KC)
   3. Re:  Square root algorithm (mike h)
   4. Re:  Square root algorithm (mike h)


----------------------------------------------------------------------

Message: 1
Date: Sat, 9 Sep 2017 06:40:09 +0800
From: yi lu <zhiwudazhanjiang...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Square root algorithm
Message-ID:
        <CAKcmqqw9LiX7jD9dpELncd+3yUzpq4ud8bk7=ybp4pal3e5...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

I don't know why this email was marked as spam, but it could be worth
discussing.

On Sun, Sep 3, 2017 at 4:22 PM, mike h <mike_k_hough...@yahoo.co.uk> wrote:

> Hi,
>
> To help me in learning Haskell I started blogging about some of the things
> I’ve looked at.
> One such topic was calculating square roots ‘by hand’ and then deriving a
> Haskell algorithm.
> I wrote about the well known  technique here
> http://gitcommit.co.uk/2017/08/25/the-root-of-the-problem-part-1/
>
> and it it is really quite a simple method.
>
> The second part of the post will be an implementation in Haskell.
>
> 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.
>
> 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.
>
> I’ve created a gist of the code here
> https://gist.github.com/banditpig
>
> Many Thanks
>
> Mike
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20170909/689f641b/attachment-0001.html>

------------------------------

Message: 2
Date: Fri, 8 Sep 2017 21:49:58 -0700
From: KC <kc1...@gmail.com>
To: Haskell Beginners <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Square root algorithm
Message-ID:
        <CAMLKXynatgYHWefV8dSkPSQMCfCpLzABrvcvnffBiUNmy1c=i...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

One approach

One function to compute the next iterate

Another function to call the computation function until results are within
some tolerance

It's usually presented as separation of control and computation 😎

--
Sent from an expensive device which will be obsolete in a few months
Casey

On Sep 3, 2017 1:23 AM, "mike h" <mike_k_hough...@yahoo.co.uk> wrote:

> Hi,
>
> To help me in learning Haskell I started blogging about some of the things
> I’ve looked at.
> One such topic was calculating square roots ‘by hand’ and then deriving a
> Haskell algorithm.
> I wrote about the well known  technique here
> http://gitcommit.co.uk/2017/08/25/the-root-of-the-problem-part-1/
>
> and it it is really quite a simple method.
>
> The second part of the post will be an implementation in Haskell.
>
> 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.
>
> 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.
>
> I’ve created a gist of the code here
> https://gist.github.com/banditpig
>
> Many Thanks
>
> Mike
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20170908/0f1f94c8/attachment-0001.html>

------------------------------

Message: 3
Date: Sat, 9 Sep 2017 08:03:11 +0100
From: mike h <mike_k_hough...@yahoo.co.uk>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Square root algorithm
Message-ID: <ac8d4608-17d4-4818-a5a6-73af51f16...@yahoo.co.uk>
Content-Type: text/plain; charset="utf-8"

Thanks I’ll look into that.

To recap I have an unattractive but working implementation here 
https://gist.github.com/banditpig <https://gist.github.com/banditpig>
and the algorithm is described here  
http://gitcommit.co.uk/2017/08/25/the-root-of-the-problem-part-1/
Thanks

Mike


> On 9 Sep 2017, at 05:49, KC <kc1...@gmail.com> wrote:
> 
> One approach 
> 
> One function to compute the next iterate
> 
> Another function to call the computation function until results are within 
> some tolerance 
> 
> It's usually presented as separation of control and computation 😎
> 
> --
> Sent from an expensive device which will be obsolete in a few months
> Casey
> 
> On Sep 3, 2017 1:23 AM, "mike h" <mike_k_hough...@yahoo.co.uk 
> <mailto:mike_k_hough...@yahoo.co.uk>> wrote:
> Hi,
> 
> To help me in learning Haskell I started blogging about some of the things 
> I’ve looked at. 
> One such topic was calculating square roots ‘by hand’ and then deriving a 
> Haskell algorithm. 
> I wrote about the well known  technique here
> http://gitcommit.co.uk/2017/08/25/the-root-of-the-problem-part-1/ 
> <http://gitcommit.co.uk/2017/08/25/the-root-of-the-problem-part-1/>
> 
> and it it is really quite a simple method. 
> 
> The second part of the post will be an implementation in Haskell. 
> 
> 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. 
> 
> 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. 
> 
> I’ve created a gist of the code here
> https://gist.github.com/banditpig <https://gist.github.com/banditpig>
> 
> Many Thanks
> 
> Mike
> 
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org <mailto:Beginners@haskell.org>
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners 
> <http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners>
> 
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20170909/93983c2f/attachment-0001.html>

------------------------------

Message: 4
Date: Sat, 9 Sep 2017 08:44:57 +0100
From: mike h <mike_k_hough...@yahoo.co.uk>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Square root algorithm
Message-ID: <cc3a977b-e43d-4417-aa5b-921db1430...@yahoo.co.uk>
Content-Type: text/plain; charset="utf-8"

I’m sort of seeing this as a foldr over a list of digit pairs with the seed 
value of the fold being the first step of the algorithm (which is different 
from the other steps).
The list of pairs will be of indeterminate length as ’00’ is used until the 
required number of digits in the result is achieved.
A minor wrinkle with this is if the input number is a perfect square then a lot 
of ‘0’s would be in the result.

Then, after the fold,  apply some simple function to determine where the 
decimal point should go.


M


> On 9 Sep 2017, at 05:49, KC <kc1...@gmail.com> wrote:
> 
> One approach 
> 
> One function to compute the next iterate
> 
> Another function to call the computation function until results are within 
> some tolerance 
> 
> It's usually presented as separation of control and computation 😎
> 
> --
> Sent from an expensive device which will be obsolete in a few months
> Casey
> 
> On Sep 3, 2017 1:23 AM, "mike h" <mike_k_hough...@yahoo.co.uk 
> <mailto:mike_k_hough...@yahoo.co.uk>> wrote:
> Hi,
> 
> To help me in learning Haskell I started blogging about some of the things 
> I’ve looked at. 
> One such topic was calculating square roots ‘by hand’ and then deriving a 
> Haskell algorithm. 
> I wrote about the well known  technique here
> http://gitcommit.co.uk/2017/08/25/the-root-of-the-problem-part-1/ 
> <http://gitcommit.co.uk/2017/08/25/the-root-of-the-problem-part-1/>
> 
> and it it is really quite a simple method. 
> 
> The second part of the post will be an implementation in Haskell. 
> 
> 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. 
> 
> 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. 
> 
> I’ve created a gist of the code here
> https://gist.github.com/banditpig <https://gist.github.com/banditpig>
> 
> Many Thanks
> 
> Mike
> 
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org <mailto:Beginners@haskell.org>
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners 
> <http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners>
> 
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20170909/333f3743/attachment.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 111, Issue 6
*****************************************

Reply via email to