
On 2006-04-06 at 11:25EDT "Michael Goodrich" wrote:
Thanks so much for your help. I should have made clear that I was aware that the definitions were mutually dependent. What I was hoping was that Haskell could solve this for me without my having to resort to effectively finessing any sequencing considerations.
Perhaps I am really asking it to do too much.
I think so. Haskell doesn't do anything magic; it's a programming language rather than a mathematical amanuensis, so you have to say what the algorithm is. In the kind of thing you were attempting, ⊥ is a valid solution to the equations, as in f a = g a + 1 g b = f a - 1 where, while f x = x+x + 1, g x = (x+x+1) - 1 is a valid solution, so are many others, and in particular so is f x = ⊥, g x = ⊥, which also has the merit of being simpler. If you want an iteration over values to happen, you have to say where to start and how to get from one approximation to the next (if you don't, how would the compiler choose for you?), and Haskell is very good at this, as described in the paper by John Hughes that someone posted earlier. Jón -- Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk