[Haskell-beginners] Y-combinator
edgar at ymonad.com
edgar at ymonad.com
Wed Feb 24 15:30:19 EST 2010
http://lmgtfy.com/?q=y+combinator+haskell
Cheers,
Edgar
On Wed, 24/Feb/2010 at 20:41 +0000, Jon Harrop wrote:
>
> OCaml can do this:
>
> $ ocaml -rectypes
> Objective Caml version 3.11.1
>
> # let fix f = (fun x -> f(x x)) (fun x y -> f(x x) y);;
> val fix : (('a -> 'b) -> 'a -> 'b) -> 'a -> 'b = <fun>
>
> # fix (fun f -> function 0 -> 1 | n -> n*f(n-1)) 10;;
> - : int = 3628800
>
> Haskell 98 doesn't seem to be able to type check that definition of the
> y-combinator directly. Is there a Haskell extension that would let it handle
> this?
>
> --
> Dr Jon Harrop, Flying Frog Consultancy Ltd.
> http://www.ffconsultancy.com/?e
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
More information about the Beginners
mailing list