Re: [Haskell] Y in haskell?

2005-04-17 Thread Bernard Pope
On Mon, 2005-04-18 at 15:35 +1000, Bernard Pope wrote: > On Mon, 2005-04-18 at 01:08 -0400, David Menendez wrote: > > Trevion writes: > > > > > On 4/18/05, Lloyd Allison <[EMAIL PROTECTED]> > > wrote: > > > > Is it possible to define Y in Haskell (pref' H98) -- > > > > and get it to pass type chec

Re: [Haskell] Y in haskell?

2005-04-17 Thread Bernard Pope
On Mon, 2005-04-18 at 01:08 -0400, David Menendez wrote: > Trevion writes: > > > On 4/18/05, Lloyd Allison <[EMAIL PROTECTED]> > wrote: > > > Is it possible to define Y in Haskell (pref' H98) -- > > > and get it to pass type checking? > > > > I believe that > > > > y f = f (y f) > > > > is the

Re: [Haskell] Y in haskell?

2005-04-17 Thread David Menendez
Trevion writes: > On 4/18/05, Lloyd Allison <[EMAIL PROTECTED]> wrote: > > Is it possible to define Y in Haskell (pref' H98) -- > > and get it to pass type checking? > > I believe that > > y f = f (y f) > > is the normal way to do it. I've also seen this: y f = g where g = f g --

Re: [Haskell] Y in haskell?

2005-04-17 Thread Trevion
On 4/18/05, Lloyd Allison <[EMAIL PROTECTED]> wrote: > Is it possible to define Y in Haskell (pref' H98) -- > and get it to pass type checking? I believe that y f = f (y f) is the normal way to do it. .trev ___ Haskell mailing list Haskell@haskell.

[Haskell] Y in haskell?

2005-04-17 Thread Lloyd Allison
Is it possible to define Y in Haskell (pref' H98) -- and get it to pass type checking? -- E.g. As in SML let datatype 'a rt = recrt of ('a rt) -> 'a; fun Y G= let fun Ggg (recrt g) n = G(g (recrt g))n in Ggg (recrt Ggg) end; fun F f n = if n=0 then 1 else n*f(n-1