[Haskell-beginners] Y-combinator

Edward Z. Yang ezyang at MIT.EDU
Wed Feb 24 15:53:14 EST 2010


Excerpts from Jon Harrop's message of Wed Feb 24 15:41:01 -0500 2010:
> 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

http://haskell.org/hoogle/3/?q=fix

Cheers,
Edward


More information about the Beginners mailing list