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

210 Views Asked by At

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?

1

There are 1 best solutions below

3
Julian Fondren On BEST ANSWER

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; ...]