2
如果我想要写在OCaml中list.ml
,如何在OCaml中编写列表?
Q1
哪条路是正确的?
type 'a list =
| Nil
| Cons of 'a * ('a list)
或
type 'a list =
| Nil
| Cons of 'a * 'a list
什么不同吗?
Q2
而且,我怎么定义的类型定义为::
内Cons
?
Q3
如何定义Nil
类型定义为[]
里面?