【问题标题】:Standard ML: Binary Tree Datatype标准 ML:二叉树数据类型
【发布时间】:2015-08-13 05:27:19
【问题描述】:

我的笔记包括以下二叉树的定义:

datatype tree = Empty | Node of tree * int * tree

我怎么知道定义中的第二个选项是否应该表示:

Node of (tree * int * tree)

Node of tree * int * tree?

谢谢,

布莱曼

【问题讨论】:

    标签: functional-programming sml


    【解决方案1】:

    Node of (tree * int * tree)Node of tree * int * tree是一样的

    【讨论】:

    • 我在想可能是(Node of tree) * int * tree...再次感谢!
    • @bclayman:数据类型声明中的每个分支都是ConstructorConstructor of type。所以(Node of tree) * int * tree 的格式不正确。顺便说一句——如果马特的回答解决了你的问题,感谢他的最好方法是通过点击左边的绿色复选框来“接受”这个答案。这会让其他人知道你的问题已经解决,并且会给他+15声望点(而你自己+2)。
    猜你喜欢
    • 2011-12-20
    • 1970-01-01
    • 1970-01-01
    • 2016-09-03
    • 1970-01-01
    • 2015-10-19
    • 2017-03-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多