See SML full list

大憨熊 提交于 2019-12-01 11:14:12

Assuming that you are using SML/NJ.

What you wan't to customize is the reference values in Control.Print. In this case you wan't to change the value of printLength to something larger, for example

Control.Print.printLength := 100;

In general it is the print* references you wan't to change. However for strings, they chose to call it stringDepth, for some reason.


Assuming that you are using MosML.

From the Moscow ML Language Overview, it is described that the Meta unit exposes these two functions (to "control the interactive system")

val printDepth : int ref  (* limit printed data depth *)
val printLength : int ref (* limit printed list and vector length *)

I assume you are using Poly/ML. The function PolyML.print_depth says how deep printing should go in any structure (lists included). Change it to something larger:

PolyML.print_depth 500

This output is only for debugging and while is convenient, is not a proper way to do so (you don't get this from running an executable if you generate it). To print out all elements independent of print limit set in ML prompt of your choice, you can do following:

fun listToString [] = "[]\n"
|   listToString (c::l) =
        "[" ^ (Int.toString c)
        ^ foldl (fn (s1, s2) => s2 ^ ", " ^ s1) "" (map (Int.toString) l)
        ^ "]\n"
val _  = print (listToString a)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!