ZoCode
ZoCode

Reputation: 51

How to show a list with large length in ocaml (toplevel)

I have created a list that contains a lot of elements in ocaml and I want to see whats inside it, but ocaml is only showing me a small part of it like this: [e1,e2,e3;...]. How can I configure ocaml to show everything?

Upvotes: 3

Views: 224

Answers (1)

Julian Fondren
Julian Fondren

Reputation: 5619

You can see longer and deeper structures, interactively, with #print_length and #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; ...]

Upvotes: 7

Related Questions