Thanks Danny and Matthew, this is seems to work well, it is like include, but for an interaction environment:<div><br></div><div><div>@(require racket/sandbox</div><div> scribble/eval</div><div> racket</div>
<div> (for-syntax racket))</div><div><br></div><div>@(define-syntax (ieval stx) </div><div> (define (get-file path)</div><div> (define fis (open-input-file #:mode 'text path))</div><div> (port-count-lines! fis)</div>
<div> (define-values (start-line start-column start-position) (port-next-location fis))</div><div> (define datums (port->list (lambda (port) (read-syntax path port)) fis))</div><div> (define-values (end-line end-column end-position) (port-next-location fis))</div>
<div> (close-input-port fis)</div><div> (define contents (datum->syntax #f datums (list path start-line start-column start-position </div><div> (if (and (number? start-position)</div>
<div> (number? end-position))</div><div> (- end-position start-position)</div><div> #f))))</div><div>
(cons path contents))</div><div> (syntax-case stx ()</div><div> [(_ evaluator path)</div><div> (with-syntax ([(exp ...) (get-file (syntax->datum #'path))])</div><div> (syntax</div><div> (begin</div>
<div> @interaction[#:eval </div><div> evaluator</div><div> exp ...])))]))</div><div><br></div><div>; Usage</div><div><br></div><div><div>@(define my-evaluator</div><div>
(parameterize ([sandbox-output 'string]</div><div> [sandbox-error-output 'string])</div><div> (make-evaluator 'racket)))</div></div><div><br></div><div>@(ieval my-evaluator "/home/gcr/racket-external-eval/some.rkt")</div>
<br><div class="gmail_quote">On Thu, Jan 10, 2013 at 1:36 PM, Danny Yoo <span dir="ltr"><<a href="mailto:dyoo@hashcollision.org" target="_blank">dyoo@hashcollision.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">> 1. Although the code collects the contents of that file in a list, is<br>
> there a way to splice (for lack of a better term) the contents of that<br>
> list into the scribble doc? The reason is that the generated document<br>
> is not identical to the original code:<br>
<br>
<br>
</div>Maybe with the splice form? But my understanding was that Scribble<br>
treats lists of pre-content as pre-content.<br>
<div class="im"><br>
<br>
<br>
> 2. I would like to insert the path name as a comment before the<br>
> imported text file. Is it as symbol as consing a symbol version of the<br>
> comment onto the datum list read by the file? I will check.<br>
<br>
</div>Unfortunately, I'm not sure about this yet.<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Grant Rettke | ACM, AMA, COG, IEEE<br><a href="mailto:grettke@acm.org" target="_blank">grettke@acm.org</a> | <a href="http://www.wisdomandwonder.com/" target="_blank">http://www.wisdomandwonder.com/</a><br>
Wisdom begins in wonder.<br>((λ (x) (x x)) (λ (x) (x x)))
</div>