【发布时间】:2011-12-20 15:55:32
【问题描述】:
我知道以前有人问过这个问题,但以前的问题中没有一个答案对我有用,所以我会尝试不同的方法。
我已经这样做了:
> datatype which = STRING of string | INT of int;
datatype which = INT of int | STRING of string
> datatype whichTree = Empty | Leaf of which | Node of whichTree*whichTree;
datatype whichTree = Empty | Leaf of which | Node of whichTree * whichTree
但是当我尝试构建一棵树时
> val mytree = Node(Leaf(which 2), Leaf(which 6));
我收到错误。
Error-Value or constructor (which) has not been declared Found near
Node( Leaf(which(2)), Leaf(which(6)))
Error-Value or constructor (which) has not been declared Found near
Node( Leaf(which(2)), Leaf(which(6)))
Static errors (pass2)
【问题讨论】:
标签: binary-tree sml ml