3.11 Exemples
type_check (Const (Int 3));;
*
it : int
*
- : unit = ()
type_check (Const (Float 3.2));;
*
it : float
*
- : unit = ()
type_check (Abs (``x'', Pair(Var ``x'', Var ``x'')));;
*
it : ('a -> ('a * 'a))
*
- : unit = ()
type_check (Cond (App (Var ``='', Pair(Const(Int 0), Const (Int 0)))
*
, Const(Int 2)
*
, Const(Int 5)))
*
;;
*
it : int
*
- : unit = ()
type_check (Letrecin (``fact'',
*
Abs (``x'', Cond (App (Var ``='',Pair(Var ``x'',Const(Int 1)))
*
,Const(Int 1)
*
,App (Var ``*''
*
,Pair(Var ``x''
*
,App (Var ``fact''
*
,App (Var``-''
*
,Pair(Var ``x''
*
,Const(Int 1) ))))) ))
*
, App (Var ``fact'', Const (Int 4))));;
*
it : int
*
- : unit = ()