Re: How to utop to print out really large lists.
| Newsgroups | gmane.comp.lang.ocaml.beginners |
|---|---|
| Message-ID | <[email protected]> |
Hi, I for myself would not ask utop to do this, since a List.iter (fun i -> print_int i; print_string " ") yourlist is enough. And hacking in such code snippets is a nice finger training IMO. /Str. On 05.02.2016 19:02, Douglas Lewit [email protected] [ocaml_beginners] wrote: > > Hi everyone, > > So let's say that I'm using the following function to create a list of random integers: > > *let rec randomList lower upper size = if size = 0 then [ ] else ( lower + > Random.int ( upper - lower + 1 )* > *:: ( randomList lower upper ( size - 1 ) ) ;;* > > The function works great! I end up with a list of length size having random > integers in the range lower..upper ( including the endpoints of that range ). But > here's the catch. > > Let's say that I do this: > > *let dougsList = randomList 1 1000 1000 ;;* > > Okay, great.... but if I'm using the */_utop interface_/* for OCaml, then I can > only see about the first 350 ( approximately ) elements of my random list. Is > there some setting in utop that I can change so that utop is forced to print out > the entire list for the sake of my visual inspection. I realize that visually > inspecting a list of 1,000 elements sounds rather crazy and unrealistic, but the > user of the interface should have that option. > > Thanks for helping me solve this problem. > > Best, > > Douglas Lewit > > >