[racket] Need help with running racket from the command-line
Probably submodules are a better way to accomplish the larger goal of
what you're doing here (you'd put the call to 'echo' in, say, a main
submodule), but just in case they aren't, here's the precise
commandline you need:
$ racket -t echo.rkt -l racket/base -e '(echo 1)'
1
Although you'd successfully exported "echo" to a place where a "-e"
command-line argument can find it, you'd not exported a notion of
function application. Adding -l racket/base exports racket's notion of
function application.
Robby
On Sun, Aug 19, 2012 at 5:42 PM, Rouben Rostamian <rostamian at umbc.edu> wrote:
> I am having difficulty in interpreting Racket's command-line
> options described in the User Guide. Please help if you can.
>
> I want to do something like this:
>
> racket -t echo.rkt -e '(echo "hi")'
>
> The file echo.rkt (which is given at the end of this message)
> is a module that provides a function "echo" which simply prints
> its argument to the terminal.
>
> I expect the Unix command
>
> racket -t echo.rkt -e '(echo "hi")'
>
> to print "hi" to the terminal and exit. But it doesn't; it complains
> about an unbound identifier. This is Racket v5.1.3, if it matters.
>
> Here is the content of the file echo.rkt:
>
> ;; echo.rkt ------------
>
> #lang racket
>
> (provide echo)
>
> (define (echo x)
> (display x)
> (newline))
>
> ;; end of echo.rkt -----
>
>
> --
> Rouben Rostamian
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users