SMLNJ expand # in output

有些话、适合烂在心里 提交于 2019-12-02 23:46:52

问题


I have the following:

val it = DATAX ("hello",DATAX ("world",DATAX #,DATAX #),...

Is there a way to make the SMLNJ interpreter expand "#" so that I can see what the exact data is? Thanks!


回答1:


Ok. I found an answer:

http://www.cs.cmu.edu/~me/212/environment.html

When SML/NJ prints a data structure, it prints that data structure only to a certain depth. Beneath that depth it prints a # instead. This is generally a good thing, since data structures can be very large (and even cyclic). However, the default depth to which SML/NJ prints data structures is 5, which is usually not enough. You can adjust the depth to which it prints data structures by entering, for example,

  • Control.Print.printDepth := 10;

to set the depth to 10. SML/NJ also abbreviates lists and strings over a certain length. You can set the length at which this happens by setting Control.Print.printLength and Control.Print.stringDepth, in a manner analogous to the above.



来源:https://stackoverflow.com/questions/3756460/smlnj-expand-in-output

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!