On Nov 17, 2007 3:04 PM, apfelmus &lt;<a href="mailto:apfelmus@quantentunnel.de">apfelmus@quantentunnel.de</a>&gt; wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br></div>Unfortunately, I don&#39;t have Paulson&#39;s book (or any other ML book :) at<br>home. I&#39;m too lazy to figure out the specification from the source code,</blockquote><div><br>I guess the code is too opaque, as my colleague claimed. 
<br></div><div><br>The layout the algorithm generates condensed indented blocks.&nbsp; Within a block, it inserts a newline when the distance to the next break point plus the current position is greater than the space remaining on the current line.&nbsp;&nbsp; Thus if S-Expression lists are rendered as blocks with indent two, and every element in a list is separated by a break point of length one, with the proper margin, you would see:
<br><br>(defthingy name-of-thingy<br>&nbsp; (one thing) (two thing)<br>&nbsp; (a-big-thing-made-bigger)<br>&nbsp; (three thing) (four thing))<br><br>As an exercise, the book asks you to implement group indent, where if any break point in a group inserts a newline, they all do.&nbsp; So with that layout, one would get:
<br><br>(defthingy<br>&nbsp; name-of-thingy<br>&nbsp; (one thing)<br>&nbsp; (two thing)<br>&nbsp; (a-big-thing-made-bigger)<br>&nbsp; (there thing)<br>&nbsp; (four thing))<br><br>The C version I wrote supports this layout, but I didn&#39;t bother with that extension for the Haskell version.
<br><br>On the strictness annotations, my reasons for them are the usual ones, primarily to prevent memory leaks due to dragging, but a performance boost is always welcome.&nbsp; At some point, I plan to profile the code with and without the annotations, and find out where they are needed.
<br><br>John<br>  </div></div><br>