Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007528OCamlmiscpublic2017-05-04 23:532017-05-07 09:47
Reportermars0i 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
PlatformocamlOSOS XOS Version10.11.6
Product Version4.04.0 
Target VersionFixed in Version 
Summary0007528: Complex lists always wrap at 80 columns or less
DescriptionThis is an issue observed in the ocaml toplevel. It can be demonstrated in utop as well. (This is my first time using Mantis. I'm not sure whether I entered all of the information correctly.)

When the display margin in a toplevel is set to > 80 columns, lists with simple elements will display using a margin greater than 80, but lists containing lists or tuples will wrap at or near 80 columns even when set_margin_function is used to specify a larger margin. If a margin smaller than 80 is set with set_margin_function, both simple lists and those with more complex elements wrap at the chosen margin. When the margin is subsequently set to a larger value, the complex lists continue to wrap at the narrower margin.
Steps To ReproduceThe following was run in the OCaml toplevel, version 4.04.0 on OS X 10.11.6. To see the effect in utop, replace "Format.pp_set_margin Format.std_formatter <integer>" with "UTop.set_margin_function (fun _ -> Some <integer>)"

# Format.pp_set_margin Format.std_formatter 120;;
- : unit = ()
# let l = Batteries.List.range 0 `To 100;;
val l : int list =
  [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24; 25; 26; 
27; 28; 29; 30;
   31; 32; 33; 34; 35; 36; 37; 38; 39; 40; 41; 42; 43; 44; 45; 46; 47; 48; 49; 50; 51; 52; 53; 54; 55; 
56; 57; 58; 59;
   60; 61; 62; 63; 64; 65; 66; 67; 68; 69; 70; 71; 72; 73; 74; 75; 76; 77; 78; 79; 80; 81; 82; 83; 84; 
85; 86; 87; 88;
   89; 90; 91; 92; 93; 94; 95; 96; 97; 98; 99; 100]
# let ll = Batteries.List.map (fun x -> [x]) l;;
val ll : int list list =
  [[0]; [1]; [2]; [3]; [4]; [5]; [6]; [7]; [8]; [9]; [10]; [11]; [12];
   [13]; [14]; [15]; [16]; [17]; [18]; [19]; [20]; [21]; [22]; [23];
   [24]; [25]; [26]; [27]; [28]; [29]; [30]; [31]; [32]; [33]; [34];
   [35]; [36]; [37]; [38]; [39]; [40]; [41]; [42]; [43]; [44]; [45];
   [46]; [47]; [48]; [49]; [50]; [51]; [52]; [53]; [54]; [55]; [56];
   [57]; [58]; [59]; [60]; [61]; [62]; [63]; [64]; [65]; [66]; [67];
   [68]; [69]; [70]; [71]; [72]; [73]; [74]; [75]; [76]; [77]; [78];
   [79]; [80]; [81]; [82]; [83]; [84]; [85]; [86]; [87]; [88]; [89];
   [90]; [91]; [92]; [93]; [94]; [95]; [96]; [97]; [98]; [99]; [100]]
# Format.pp_set_margin Format.std_formatter 40;;
- : unit = ()
# l;;
- : int list =
[0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11;
 12; 13; 14; 15; 16; 17; 18; 19; 20;
 21; 22; 23; 24; 25; 26; 27; 28; 29;
 30; 31; 32; 33; 34; 35; 36; 37; 38;
 39; 40; 41; 42; 43; 44; 45; 46; 47;
 48; 49; 50; 51; 52; 53; 54; 55; 56;
 57; 58; 59; 60; 61; 62; 63; 64; 65;
 66; 67; 68; 69; 70; 71; 72; 73; 74;
 75; 76; 77; 78; 79; 80; 81; 82; 83;
 84; 85; 86; 87; 88; 89; 90; 91; 92;
 93; 94; 95; 96; 97; 98; 99; 100]
# ll;;
- : int list list =
[[0]; [1]; [2]; [3];
 [4]; [5]; [6]; [7];
 [8]; [9]; [10]; [11];
 [12]; [13]; [14]; [15];
 [16]; [17]; [18]; [19];
 [20]; [21]; [22]; [23];
 [24]; [25]; [26]; [27];
 [28]; [29]; [30]; [31];
 [32]; [33]; [34]; [35];
 [36]; [37]; [38]; [39];
 [40]; [41]; [42]; [43];
 [44]; [45]; [46]; [47];
 [48]; [49]; [50]; [51];
 [52]; [53]; [54]; [55];
 [56]; [57]; [58]; [59];
 [60]; [61]; [62]; [63];
 [64]; [65]; [66]; [67];
 [68]; [69]; [70]; [71];
 [72]; [73]; [74]; [75];
 [76]; [77]; [78]; [79];
 [80]; [81]; [82]; [83];
 [84]; [85]; [86]; [87];
 [88]; [89]; [90]; [91];
 [92]; [93]; [94]; [95];
 [96]; [97]; [98]; [99];
 [100]]
# Format.pp_set_margin Format.std_formatter 120;;
- : unit = ()
# l;;
- : int list =
[0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24; 25; 26; 27; 
28; 29; 30; 31;
 32; 33; 34; 35; 36; 37; 38; 39; 40; 41; 42; 43; 44; 45; 46; 47; 48; 49; 50; 51; 52; 53; 54; 55; 56; 
57; 58; 59; 60;
 61; 62; 63; 64; 65; 66; 67; 68; 69; 70; 71; 72; 73; 74; 75; 76; 77; 78; 79; 80; 81; 82; 83; 84; 85; 
86; 87; 88; 89;
 90; 91; 92; 93; 94; 95; 96; 97; 98; 99; 100]
# ll;;
- : int list list =
[[0]; [1]; [2]; [3];
 [4]; [5]; [6]; [7];
 [8]; [9]; [10]; [11];
 [12]; [13]; [14]; [15];
 [16]; [17]; [18]; [19];
 [20]; [21]; [22]; [23];
 [24]; [25]; [26]; [27];
 [28]; [29]; [30]; [31];
 [32]; [33]; [34]; [35];
 [36]; [37]; [38]; [39];
 [40]; [41]; [42]; [43];
 [44]; [45]; [46]; [47];
 [48]; [49]; [50]; [51];
 [52]; [53]; [54]; [55];
 [56]; [57]; [58]; [59];
 [60]; [61]; [62]; [63];
 [64]; [65]; [66]; [67];
 [68]; [69]; [70]; [71];
 [72]; [73]; [74]; [75];
 [76]; [77]; [78]; [79];
 [80]; [81]; [82]; [83];
 [84]; [85]; [86]; [87];
 [88]; [89]; [90]; [91];
 [92]; [93]; [94]; [95];
 [96]; [97]; [98]; [99];
 [100]]
Additional InformationI originally reported this as an issue in utop (https://github.com/diml/utop/issues/208 [^]), but it was suggested there that it was a bug in the OCaml pretty printer.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0017768)
mars0i (reporter)
2017-05-04 23:58

My apologies--there's some unnecessary junk at the beginning of the example text. I don't see a way to edit the report, however. I'd suggest beginning reading the example after these lines:
# Format.pp_set_margin Format.std_formatter 120;;
# Format.pp_set_margin Format.std_formatter 120;;
(0017773)
mars0i (reporter)
2017-05-05 21:16
edited on: 2017-05-07 09:47

I discovered that lists with large elements may be displayed at a width that is less than the specified margin but that is nevertheless greater than 80 columns. This is illustrated by the third list below.

# Format.pp_set_margin Format.std_formatter 120;;
- : unit = ()
# let l = Batteries.List.range 0 `To 100;;
val l : int list =
  [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24; 25; 26; 
27; 28; 29; 30;
   31; 32; 33; 34; 35; 36; 37; 38; 39; 40; 41; 42; 43; 44; 45; 46; 47; 48; 49; 50; 51; 52; 53; 54; 55; 
56; 57; 58; 59;
   60; 61; 62; 63; 64; 65; 66; 67; 68; 69; 70; 71; 72; 73; 74; 75; 76; 77; 78; 79; 80; 81; 82; 83; 84; 
85; 86; 87; 88;
   89; 90; 91; 92; 93; 94; 95; 96; 97; 98; 99; 100]
# let ll = Batteries.List.map (fun x -> [float x]) l;;
val ll : float list list =
  [[0.]; [1.]; [2.]; [3.]; [4.]; [5.]; [6.]; [7.]; [8.]; [9.]; [10.];
   [11.]; [12.]; [13.]; [14.]; [15.]; [16.]; [17.]; [18.]; [19.]; [20.];
   [21.]; [22.]; [23.]; [24.]; [25.]; [26.]; [27.]; [28.]; [29.]; [30.];
   [31.]; [32.]; [33.]; [34.]; [35.]; [36.]; [37.]; [38.]; [39.]; [40.];
   [41.]; [42.]; [43.]; [44.]; [45.]; [46.]; [47.]; [48.]; [49.]; [50.];
   [51.]; [52.]; [53.]; [54.]; [55.]; [56.]; [57.]; [58.]; [59.]; [60.];
   [61.]; [62.]; [63.]; [64.]; [65.]; [66.]; [67.]; [68.]; [69.]; [70.];
   [71.]; [72.]; [73.]; [74.]; [75.]; [76.]; [77.]; [78.]; [79.]; [80.];
   [81.]; [82.]; [83.]; [84.]; [85.]; [86.]; [87.]; [88.]; [89.]; [90.];
   [91.]; [92.]; [93.]; [94.]; [95.]; [96.]; [97.]; [98.]; [99.]; [100.]]
# let ll = Batteries.List.map (fun x -> [(float x)**0.5]) l;;
val ll : float list list =
  [[0.]; [1.]; [1.41421356237309515]; [1.73205080756887719]; [2.]; [2.23606797749979];
   [2.44948974278317788]; [2.64575131106459072]; [2.82842712474619029];
   [3.]; [3.16227766016837952]; [3.3166247903554]; [3.46410161513775439];
   [3.60555127546398912]; [3.74165738677394133]; [3.87298334620741702];
   [4.]; [4.12310562561766059]; [4.24264068711928477]; [4.35889894354067398];
   [4.47213595499958]; [4.58257569495584]; [4.69041575982343]; [4.79583152331271911];
   [4.89897948556635576]; [5.]; [5.09901951359278449]; [5.19615242270663202];
   [5.29150262212918143]; [5.38516480713450374]; [5.47722557505166119];
   [5.56776436283002152]; [5.65685424949238058]; [5.74456264653802862];
   [5.83095189484530074]; [5.91607978309961613]; [6.]; [6.08276253029821934];
   [6.16441400296897601]; [6.24499799839839831]; [6.32455532033675905];
   [6.40312423743284853]; [6.48074069840786]; [6.557438524302]; [6.6332495807108];
   [6.70820393249936942]; [6.78232998312526814]; [6.85565460040104391];
   [6.92820323027550877]; [7.]; [7.07106781186547551]; [7.14142842854285];
   [7.21110255092797825]; [7.28010988928051805]; [7.34846922834953453];
   [7.41619848709566298]; [7.48331477354788266]; [7.54983443527075];
   [7.61577310586390865]; [7.68114574786860782]; [7.74596669241483404];
   [7.81024967590665398]; [7.87400787401181113]; [7.93725393319377215];
   [8.]; [8.06225774829855]; [8.12403840463596]; [8.18535277187245];
   [8.24621125123532117]; [8.30662386291807486]; [8.36660026534075563];
   [8.42614977317635905]; [8.48528137423857]; [8.54400374531753]; [8.60232526704262668];
   [8.6602540378443873]; [8.71779788708134795]; [8.77496438739212259];
   [8.83176086632784774]; [8.88819441731558868]; [8.94427190999916];
   [9.]; [9.0553851381374173]; [9.1104335791443]; [9.16515138991168];
   [9.21954445729288707]; [9.27361849549570394]; [9.32737905308881565];
   [9.38083151964686]; [9.43398113205660316]; [9.48683298050513812];
   [9.53939201416945615]; [9.59166304662543823]; [9.64365076099295493];
   [9.69535971483265868]; [9.74679434480896312]; [9.79795897113271153];
   [9.84885780179610393]; [9.89949493661166535]; [9.9498743710662]; [10.]]



- Issue History
Date Modified Username Field Change
2017-05-04 23:53 mars0i New Issue
2017-05-04 23:58 mars0i Note Added: 0017768
2017-05-05 21:16 mars0i Note Added: 0017773
2017-05-05 21:17 mars0i Note Edited: 0017773 View Revisions
2017-05-07 09:47 dra Steps to Reproduce Updated View Revisions
2017-05-07 09:47 dra Note Edited: 0017773 View Revisions


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker