[Haskell-cafe] Debugging Newton's method for square roots

2006-10-15 Thread Vraj Mohan
I am new to Haskell and need help in debugging my code. I wrote the following function for calculating square roots using Newton's method: my_sqrt :: Float - Float my_sqrt x = improve 1 x where improve y x = if abs (y * y - x) epsilon then y

[Haskell-cafe] searching haskell.org

2006-10-15 Thread Tamas K Papp
Hi, I noticed that searching on Haskell.org (using the Search feature at the bottom) doesn't work as I expected. For example, searching for memoise produces no results. http://www.google.com/search?q=memoise+site%3Ahaskell.org produces 18 hits. Is this intentional? Thanks, Tamas

[Haskell-cafe] Haskellers in London (UK)?

2006-10-15 Thread Ben Moseley
Hi, Just thought I'd send out a quick mail to see if there are any other Haskellers based in London who might be interested in getting together occasionally. Anyway, if you're interested please reply to this. Cheers, --Ben ___ Haskell-Cafe

[Haskell-cafe] Re: Debugging Newton's method for square roots

2006-10-15 Thread Jón Fairbairn
Vraj Mohan [EMAIL PROTECTED] writes: I am new to Haskell and need help in debugging my code. I wrote the following function for calculating square roots using Newton's method: my_sqrt :: Float - Float my_sqrt x = improve 1 x where improve y x = if abs (y * y - x) epsilon

Re: [Haskell-cafe] searching haskell.org

2006-10-15 Thread Ian Lynagh
On Sun, Oct 15, 2006 at 08:37:19AM -0400, Tamas K Papp wrote: I noticed that searching on Haskell.org (using the Search feature at the bottom) doesn't work as I expected. For example, searching for memoise produces no results. This is searching haskellwiki.

Re: [Haskell-cafe] Haskellers in London (UK)?

2006-10-15 Thread Ian Lynagh
On Sun, Oct 15, 2006 at 01:42:37PM +0100, Ben Moseley wrote: Just thought I'd send out a quick mail to see if there are any other Haskellers based in London who might be interested in getting together occasionally. Did you see

Re: [Haskell-cafe] searching haskell.org

2006-10-15 Thread Neil Mitchell
Hi I noticed that searching on Haskell.org (using the Search feature at the bottom) doesn't work as I expected. For example, searching for memoise produces no results. This is searching haskellwiki. Does anyone have the search logs for this page? If they were available, we might get a

[Haskell-cafe] Re: Debugging Newton's method for square roots

2006-10-15 Thread Jón Fairbairn
I wrote: Vraj Mohan [EMAIL PROTECTED] wrote: (The equivalent code is well-behaved on MIT Scheme) Is it? Is there equivalent code to “my_sqrt :: Float - Float”? (that might be pertinent). By which I mean HINT. (And one of the places to look for bugs is where you have hand coded a constant

Re: [Haskell-cafe] Debugging Newton's method for square roots

2006-10-15 Thread Tamas K Papp
On Sun, Oct 15, 2006 at 12:17:20PM +, Vraj Mohan wrote: I am new to Haskell and need help in debugging my code. I wrote the following function for calculating square roots using Newton's method: my_sqrt :: Float - Float my_sqrt x = improve 1 x where improve y x = if abs (y

Re: [Haskell-cafe] searching haskell.org

2006-10-15 Thread Tamas K Papp
On Sun, Oct 15, 2006 at 03:41:53PM +0100, Neil Mitchell wrote: Hi I noticed that searching on Haskell.org (using the Search feature at the bottom) doesn't work as I expected. For example, searching for memoise produces no results. This is searching haskellwiki. Does anyone have the

Re: [Haskell-cafe] Automatic fixity allocation for symbolic operators

2006-10-15 Thread Brian Hulley
Jim Apple wrote: On 10/14/06, Brian Hulley [EMAIL PROTECTED] wrote: User defined fixities are an enormous problem for an interactive editor This is the second or third time you've proposed a language change based on the editor you're writing. I don't think this is a fruitful avenue.

Re: [Haskell-cafe] Debugging Newton's method for square roots

2006-10-15 Thread Udo Stenzel
Vraj Mohan wrote: my_sqrt :: Float - Float my_sqrt x = improve 1 x where improve y x = if abs (y * y - x) epsilon then y else improve ((y + (x/y))/ 2) x epsilon = 0.1 This works for several

Re[4]: [Haskell-cafe] windows file locking

2006-10-15 Thread Bulat Ziganshin
Hello Stefan, Wednesday, October 11, 2006, 4:53:19 PM, you wrote: So far the windows API seems to work for me. Currently I'm still struggling to not write garbage to the file but the shared access works now. Does anyone have an example how to use it (e.g. the implementation of hPutStr on

Re: [Haskell-cafe] Debugging Newton's method for square roots

2006-10-15 Thread Clifford Beshers
Vraj Mohan wrote: This works for several examples that I tried out but goes into an infinite loop for my_sqrt 96. How do I go about debugging this code in GHC or Hugs? (The equivalent code is well-behaved on MIT Scheme) There was some excellent advice in the other responses, but I thought

Re: [Haskell-cafe] Re: optimization help

2006-10-15 Thread Paul Hudak
[EMAIL PROTECTED] wrote: Paul Hudak wrote: In fact avoiding space leaks was one of the motivations for our moving to an arrow framework for FRP (now called Yampa). Arrows amount to a point-free coding style, although with "arrow syntax" the cumbersomeness of programming in that

Re[2]: [Haskell-cafe] Debugging Newton's method for square roots

2006-10-15 Thread Bulat Ziganshin
Hello Udo, Sunday, October 15, 2006, 7:02:05 PM, you wrote: stops getting better. It's also the reason why you code might work with -fexcess-precision or in an untyped language or with the next or previous compiler release or on rainy days or whatever else. our brand-new GHC 22.6

Re: [Haskell-cafe] Debugging Newton's method for square roots

2006-10-15 Thread ajb
G'day all. Quoting Tamas K Papp [EMAIL PROTECTED]: 2. Newton's method is not guaranteed to converge. For computing square roots, it is. The square root function is exceedingly well-behaved. But you can make things better by choosing a smart initial estimate. The initial estimate in this