[plt-scheme] including a text file inline in slideshow

From: Doug Orleans (dougo at place.org)
Date: Sun Jun 19 17:08:31 EDT 2005

Robby Findler writes:
 > How about this (warning! untested!):
 > 
 > (apply 
 >   vl-append
 >   (call-with-input-file "filename.java"
 >    (lambda (port)
 >     (let loop ()
 >       (let ([line (read-line port)])
 >         (if (eof-object? line)
 >             null
 >             (cons (tt line) (loop))))))))

Thanks, works like a charm.  I guess I was thinking there'd be
something higher level but this is simple enough.  "vl-append" was the
main thing I didn't know about.

Now, though, I'd also like the same thing for Scheme code in an
external file.  I can't just replace "tt" with "code", since the
latter is a macro.  I tried the following but it puts everything on
one line:

  (define (scheme-file->pict file)
   (call-with-input-file file
     (lambda (port)
       (typeset-code (read-syntax file port)))))

Any hints?

--dougo at place.org



Posted on the users mailing list.