この質問が以前に尋ねられたことは知っていますが、以前の質問の回答はどれもうまくいかなかったため、別のアプローチを試してみます.
私はこれをやった:
> 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)