[plt-scheme] Can a module tell if it's being run interactively?

From: Robby Findler (robby at cs.uchicago.edu)
Date: Wed Apr 16 07:36:02 EDT 2008

On Wed, Apr 16, 2008 at 12:58 AM, Noel Welsh <noelwelsh at gmail.com> wrote:
> On Wed, Apr 16, 2008 at 12:12 AM, Richard Cobbe <cobbe at ccs.neu.edu> wrote:
>  >
>  >     #!/path/to/mzscheme
>  >     #lang mzscheme
>  >
>  >     (define (run)
>  >        (pretty-print (munge-input (read))))
>  >
>  >     (define munge-input ...)
>  >
>  >     (run)
>  >
>
>  I would split this into two modules.  One defines munge-input, the
>  other provides the script wrapper around it.  Now you can test
>  munge-input in the usual way.

Oh, right! I should have thought of that myself. One wants to be able
to use unit tests for munge-input, no?

Robby


Posted on the users mailing list.