Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 216
ZoCode Avatar asked Jan 26 '26 04:01

ZoCode


1 Answers

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; ...]
like image 73
Julian Fondren Avatar answered Jan 28 '26 21:01

Julian Fondren



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!