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);
in
Y F 3
end
(* fixed-point combinator, suitable for (strict) SML *)
(* L.Allison, Dept Comp Sci, Monash, .au. c1988 *)