如何在 ocaml (toplevel) 中显示长列表
How to show a list with large length in ocaml (toplevel)
我创建了一个包含 ocaml
中很多元素的列表,我想看看里面有什么,但是 ocaml
只向我展示了其中的一小部分,如下所示:[e1,e2,e3;...]
。如何配置 ocaml
以显示所有内容?
您可以通过 #print_length
和 #print_depth
交互查看更长更深的结构
# #print_depth 0;;
# [1;2;3;4];;
- : int list = [...]
# #print_depth 1;;
# [[1];[2];[3];[4]];;
- : int list list = [[...]; [...]; [...]; [...]]
# #print_length 3;;
# [1;2;3;4];;
- : int list = [1; 2; ...]
我创建了一个包含 ocaml
中很多元素的列表,我想看看里面有什么,但是 ocaml
只向我展示了其中的一小部分,如下所示:[e1,e2,e3;...]
。如何配置 ocaml
以显示所有内容?
您可以通过 #print_length
和 #print_depth
# #print_depth 0;;
# [1;2;3;4];;
- : int list = [...]
# #print_depth 1;;
# [[1];[2];[3];[4]];;
- : int list list = [[...]; [...]; [...]; [...]]
# #print_length 3;;
# [1;2;3;4];;
- : int list = [1; 2; ...]