[plt-scheme] Apply a procedure in a module

From: Synx (plt at synx.us.to)
Date: Mon Oct 12 16:32:51 EDT 2009

I'd like to know how to invoke mzscheme or mred or the like, so that I
can run a specific procedure inside a specific module. What I have is a
situation where I make a do-something.ss file/module and it contains
something useful to import for do-something-else.ss, so I end up having
to remove the toplevel procedure application from do-something.ss and
instead make do-do-something.ss which contains a pretty carbon copy form
of this:
#lang scheme/base
(require "do-something.ss")

Two things about that strike me as not a good idea. First off having
toplevel procedure application at all is ugly, and the only reason I do
is because I can't specify a procedure to apply on the command line.
Secondly it means I have a bunch of redundant nearly identical files
that do nothing besides import a module and apply its procedure. I'd
like to have something instead the likes of:

$ mzscheme -n -t do-something.ss -e '(main)'

...and not need to bother manually writing out a do-do-something.ss file
at all.

Another advantage to doing that is it would enable me to be more
flexible with regard to program entry points. This is very convenient
especially for testing, and in my opinion is more expressive.

Trouble is, I don't know how to do it. :(

$ mred -n -t prompt.ss -e '(watch-forever "/var/tmp/bink")'
#f::0: compile: bad syntax; function application is not allowed, because
no #%app syntax transformer is bound in: (watch-forever "/var/tmp/bink")

Help? ^.^;

Posted on the users mailing list.