【发布时间】:2016-04-23 04:01:34
【问题描述】:
我以为我在某处读到了一些关于 List.toString 的内容,但对于 l = [1,2,3]; print (List.toString (l) ),我得到的是 Error: unbound variable or constructor: toString in path List.tostring,而只有 print l 给了我
Error: operator and operand don't agree [tycon mismatch]
operator domain: string
operand: int list
in expression:
print a
那么,如何将列表转换为字符串并打印出来呢?这不可能那么难,但是在搜索如何打印一个简单的列表时,我没有找到答案。在这种情况下,我有一个整数列表。
我找到了这个
fun f (x: int list) = (PolyML.print x; ());
Here.
但它给了我Error: unbound structure: PolyML in path PolyML.print
【问题讨论】:
-
再看一下您链接到的页面,我认为它提供了足够的解释。 PolyML 是另一个 SML 编译器,你找不到那个结构,它在 SML/NJ 编译器中不可用:polyml.org
-
那么,如何在 SML/NJ 中打印列表?
-
我讨厌这种语言。谢谢。
-
很遗憾听到这个消息。我一开始也觉得这很令人沮丧,但它还有其他东西可以提供。