adamc@973: fun fst [a] [b] (x : a) (y : b) = x
adamc@973: fun snd [a] [b] (x : a) (y : b) = y
adamc@973:
adamc@974: fun fact n =
adamc@974: case n of
adamc@974: 0 => 1
adamc@974: | _ => n * fact (n - 1)
adamc@974:
adamc@975: datatype t =
adamc@975: A
adamc@975: | B of {C : int, D : float}
adamc@975: | E of t * t
adamc@975:
adamc@975: fun render x =
adamc@975: case x of
adamc@975: A => "A"
adamc@975: | B {C = n1, D = n2} => "B(" ^ show n1 ^ "," ^ show n2 ^ ")"
adamc@975: | E (x, y) => "C(" ^ render x ^ "," ^ render y ^ ")"
adamc@975:
adamc@971: fun main () =
adamc@971: s <- source "";
adamc@973: s' <- source "";
adamc@973: f <- source (plus 1);
adamc@973: f2 <- source fst;
adamc@973: r <- source {A = "x", B = "y"};
adamc@975: t <- source (E (A, B {C = 10, D = 1.23}));
adamc@975: ht <- source Nothing here yet.;
adamc@971:
adamc@971: return
adamc@973: