[plt-scheme] Re: Bad interaction w/Unix

From: SpinyNorman (jmcaxolotl at gmail.com)
Date: Fri May 18 13:46:44 EDT 2007

Thanks to both of you.  What I've incorporated so far does work.  The
invocation of md-port-chunks was outside the module by mistake.  I
will definitely want to make this (and other efforts) work w/cmdline
args, so thanks for those references.

Now I just need to get a new version of MzScheme.  I suppose DrScheme
will work with the latest and bleedingest MzScheme?

On May 18, 12:25 pm, Danny Yoo <d... at cs.wpi.edu> wrote:
> On Fri, 18 May 2007, Robby Findler wrote:
> > It is not a paren problem.
> > The name of the module (its second argument) must be the same as the
> > name of the file. So, change "client" to "md5" or change the filename
> > "md5.sh" to "client.sh".
> Hi SpinyNorman,
> One other thing to fix, though: make the call to "md-port-chunks" the last
> expression within the module, rather than an expression outside the module
> declaration.
> Putting it outside won't work too well since mzscheme in '-u'
> module-running mode expects only a single module declaration within the
> shell script.  So:
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> (module md5 mzscheme
>    (require (lib "md5.ss"))
>    (define test-string (make-string 100000))
>    (define (md-port-chunks port chunk-size)
>      (let loop ()
>        (begin
>          (display (md5 (read-bytes chunk-size port)))
>          (newline))
>        (if (not (eof-object? (peek-byte port)))
>            (loop))))
>    (md-port-chunks (open-input-string test-string) 1024))
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> It'll be ok that your module is called 'md5' and yet still use the
> standard library "md5.ss".  There's no name conflict here since the
> standard library collections are identified with a '(lib "...")' thing.
> (I'm mentioning this because this isn't necessarily true in some other
> module systems in languages like Python.)
> You'll probably want to update your program later to work with the command
> line.  Command line arguments live in the "current-command-line-arguments"
> parameter.  You might also want to search Help Desk for "cmdline", which
> offers a command line parser.
> _________________________________________________
>   For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.