Function binding
# let f x = x + 1;;
val f : int -> int =
# let g x = x + 2;;
val g : int -> int =
# f (g (g (g 3)));;
- : int = 10
# let h x y = x+y;;
val h : int -> int -> int =
# h 4 5;;
- : int = 9
# h 4;;
- : int -> int =
# let hhh = h 4;;
val hhh : int -> int =
# hhh 5;;
- : int = 9
# hhh 6;;;
- : int = 10
# let twice f x = f (f x);;
val twice : ('a -> 'a) -> 'a -> 'a =
# twice succ 3;;
- : int = 5
# twice pred 5;;
- : int = 3
# (twice twice) succ;;
- : int -> int =
# (twice twice) succ 5;;
- : int = 9
# twice twice twice succ 5;;
- : int = 21