csci2041/public-class-repo/SamplePrograms/Sec_01_1:25pm/nat.ml

7 lines
105 B
OCaml
Raw Normal View History

2018-01-29 23:35:31 +00:00
type nat = Zero | Succ of nat
let rec toInt n = match n with
| Zero -> 0
| Succ n' -> 1 + toInt n'