【问题标题】:Increasing the print depth in SML/NJ增加 SML/NJ 的打印深度
【发布时间】:2011-06-30 21:50:58
【问题描述】:

我正在尝试让 SML/NJ 在顶层打印出结果,而无需 随处放置#个标志。

根据一些旧文档(以及 2001 年此新闻组的帖子),它 应该可以使用Compiler.Control.Print.printDepth

但是,在 SML/NJ 版本 110.7 上,这只会给出错误:

- Compiler.Control.Print.printDepth := 100;
stdIn:1.1-30.8 Error: unbound structure: Control in path Compiler.Control.Print.printDepth

【问题讨论】:

    标签: sml smlnj


    【解决方案1】:

    您以后可能不想更精确。例如,您可以提供一些示例输出和指向您找到上述内容的链接。

    如果我理解你的问题是正确的,那么下面的最后一行是你的问题吗? (代码sn-p

    - datatype tree = leaf | node of int * tree * tree;
    datatype tree = leaf | node of int * tree * tree 
    
    - val t = node (1, node (2, node (3, leaf, leaf), leaf), leaf);
    val t = node (1,node (2,node #,leaf),leaf) : tree 
    

    那么Control.Print 结构就是您要寻找的。所以只需删除 Compiler 部分并使用

    Control.Print.printDepth := 100;
    

    请注意,这是特定于 SML/NJ 的,而不是 ml-yacc 本身。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-25
      • 1970-01-01
      • 1970-01-01
      • 2011-11-24
      • 1970-01-01
      • 2010-10-23
      • 2013-01-30
      • 2013-10-20
      相关资源
      最近更新 更多