当我查看堆栈的内置类型定义时:
(*ocaml-2.04/stdlib/stack.ml*)
type 'a t = { mutable c : 'a list } (*What does t mean here*)
exception Empty
let create () = { c = [] }
let clear s = s.c <- []
let push x s = s.c <- x :: s.c
let pop s = match s.c with hd::tl -> s.c <- tl; hd | [] -> raise Empty
let length s = List.length s.c
let iter f s = List.iter f s.c
类型中的变量“t”是什么意思。我认为它应该只是类型定义中的原始类型。谢谢你的解释。