[ create a new paste ] login | about

Link: http://codepad.org/vE2CJfG0    [ raw code | output | fork ]

OCaml, pasted on Jan 18:
1
2
3
4
5
6
7
8
let rec fact = function
  | n -> fact2 n 1
and fact2 n m =
  match n with
    0 -> m
  | n -> fact2 (n - 1) (m * n) ;;

print_int (fact 5) ;;


Output:
1
120


Create a new paste based on this one


Comments: