[racket] Need help with running racket from the command-line

From: Rouben Rostamian (rostamian at umbc.edu)
Date: Tue Aug 21 01:25:40 EDT 2012

Thank you, Greg, the the explanation of `current-command-line-arguments'.
Now things make sense.

And also thanks for your separate message where you pointed out
Racket's `command-line' utility to me.  I had already started
writing an ad hoc command-line parser for my application when
your message arrived.  I am going to switch to Racket's parser.

Rouben

On Mon, Aug 20, 2012 at 08:40:54AM -0400, Greg Hendershott wrote:
> 
> Racket has the idea of `parameters'. By convention, these are named
> current-xyz. Examples include current-input-port, current-output-port,
> and current-command-line-arguments.
> 
> Parameters are functions you can call to set or get a value. To get
> the current value, call with no arguments. To set, call with the new
> value.  (That's why you're seeing the function documented both ways.)
> 
> Parameters are an alternative to using a global variable and `set!'.
> There is a `parameterize' form to make it easier to temporarily change
> the value and have it restored.  Also they are per thread.
> 
> Parameters are described here:
> http://docs.racket-lang.org/guide/parameterize.html
> 
> On Mon, Aug 20, 2012 at 3:00 AM, Rouben Rostamian <rostamian at umbc.edu> wrote:
> > 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

Posted on the users mailing list.