[racket] Need help with running racket from the command-line
Oh, the use of (current-command-line-arguments) is a terrific
idea and a great improvement over what I was trying to do.
Thanks for pointing it out.
This brings me to a tangentially related question.
I am using Racket v5.1.3. Searching the manuals for
current-command-line-arguments leads to the following:
| (current-command-line-arguments)
| -> (vectorof (and/c string? immutable?))
|
| (current-command-line-arguments argv) -> void?
| argv : (vectorof (and/c string? immutable?))
|
| A parameter that is initialized with command-line arguments
| when Racket starts (not including any command-line arguments
| that were treated as flags for the system).
That's all it says. I understand the first form: it says
(current-command-line-arguments) returns the command-line
arguments in a vector. I don't understand the second form.
What is (current-command-line-arguments argv) supposed to do?
-- Rouben
On Mon, Aug 20, 2012 at 07:50:00AM +0200, Rüdiger Asche wrote:
>
> Do you need to run echo.rkt under control of racket? If you compile
> it as a standalone, you can use
>
> (current-command-line-arguments)
>
> within echo.rkt to access the vector or command line arguments.
>
> ----- Original Message ----- From: "Rouben Rostamian"
> <rostamian at umbc.edu>
> To: <users at racket-lang.org>
> Sent: Monday, August 20, 2012 12:42 AM
> Subject: [racket] Need help with running racket from the command-line
>
>
> >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