我知道在 OCaml 中,可以创建一个执行以下操作的类:
class stack_of_ints =
object (self)
val mutable the_list = ( [] : int list ) (* instance variable *)
method push x = (* push method *)
the_list <- x :: the_list
end;;
但是,我一直在努力寻找有关如何在 Reason 中执行此操作的文档。谢谢你。