<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>I understand. Specifics:&nbsp;</div><br><div><div>On Oct 3, 2011, at 7:45 PM, Doug Williams wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Basically, I'm just suggesting that the xml package have sensible printing of its structures. I can't imagine any case where you really want the default printing of recursive structures of that complexity and potential size to be the visible behavior.<br></blockquote><div><br></div><div><br></div><div>When you write very small XML pieces of data (say something that fits on 80 lines, 80 chars each), this kind of printing is just fine.&nbsp;</div><div><br></div><br><blockquote type="cite">Where it was annoying me was in my inference engine when I was doing inference across very large xml documents. I have a trace feature in the inference engine to trace assertions that is very useful for debugging rules. You can imagine the output when I turned it on the first time with one of the large xml documents. Literally, one assertion was 100+ pages.<br>
<br>I've pushed a new version of the inference engine that uses ~.s throughout. So, at least it prints it reasonable. But, it is still continually walking the structures and building a huge string (at least 10s of megabytes each at the highest levels). And, it has to do that for every assertion in a trace.<br></blockquote><div><br></div><div><br></div><div>I am proposing an alternative approach. Write an adapter module for the XML library that does NOT bother to traverse the structure to create some huge and useless string.&nbsp;</div><div><br></div><div>Is this possible for your world?&nbsp;</div><div><br></div><div>-- Matthias</div><div><br></div><div><br></div><div><br></div><br><blockquote type="cite">At least I have a large memory machine with plenty of memory (and, thanks to you guys, a 64-bit windows version), so it does run. It's just annoying.<br></blockquote><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><br><blockquote type="cite"><br><div class="gmail_quote">On Mon, Oct 3, 2011 at 4:34 PM, Matthias Felleisen <span dir="ltr">&lt;<a href="mailto:matthias@ccs.neu.edu">matthias@ccs.neu.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
Doug, does this concrete example concerning printing help:<br>
<br>
#lang racket/load<br>
<br>
(module a racket/base<br>
 &nbsp;(struct xml (bar) #:transparent)<br>
<br>
 &nbsp;(define x (xml "bar"))<br>
 &nbsp;(displayln x)<br>
<br>
 &nbsp;(provide (struct-out xml) x))<br>
<br>
(module b racket/base<br>
 &nbsp;(require 'a)<br>
<br>
 &nbsp;(struct my xml () #:property prop:custom-write (lambda (x p z) (displayln "&lt;my xml&gt;" p)))<br>
<br>
 &nbsp;(define y (my "bar"))<br>
<br>
 &nbsp;(displayln y))<br>
<br>
(require 'b)<br>
<br>
<br>
</blockquote></div><br>
</blockquote></div><br></body></html>