Re: How to utop to print out really large lists.
"Douglas Lewit [email protected] [ocaml_beginners]" <[email protected]> Fri, 5 Feb 2016 12:04:57 -0600
| Newsgroups | gmane.comp.lang.ocaml.beginners |
|---|---|
| Message-ID | <CAM0XMJSinf4PQvARCafWQ-u5CBbpASpZBR+dOSs=oP64O_CmHA@mail.gmail.com> |
Sorry about the bad English. The title should have read, "How to *customize* utop to print out really large lists". Sorry if the original title was a little confusing or misleading. On Fri, Feb 5, 2016 at 12:02 PM, Douglas Lewit [email protected] [ocaml_beginners] <[email protected]> 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 > > > >