4

我这样定义了一个 AVL 树,其中 'a -> 'a -> int 是比较函数

type 'a t = Empty of ('a -> 'a -> int)
  | Node of 'a * 'a t * 'a t * ('a -> 'a -> int)

我正在尝试使用此 AVL 模块在单独的模块中实现优先级队列。

type 'a t = Queue of (Avl.t * int)

但是当我尝试编译时,我得到了这个错误:

 Error: The type constructor Avl.t expects 1 argument(s),
   but is here applied to 0 argument(s)

它在谈论什么论点,队列类型中的语法应该是什么?

4

1 回答 1

6

您的 AVL 树由节点 ( 'a) 中的类型参数化。所以你应该可以说

type 'a t = Queue of ('a Avl.t * int)
于 2012-10-01T23:42:08.920 回答