If so, to develop the program, open the language dialog in DrRacket (cmd L) and
ask for details.
In the text box for "command line arguments ..." enter some strings between the
parentheses, like this:
#("hello" "1" "#t")
and click OK
In the definitions window, enter
#lang racket
(define argv (current-command-line-arguments))
(displayln argv)
Click RUN. Look at argv, and it will print the argv vector -- just like in
other PLs.
To run the program, create an executable, see Racket executable.
At the command line, type
$ ./foo hello 1 #t
assuming you saved the above program in foo.rkt and created the (stand-alone)
executable in the local folder .
On Sep 16, 2010, at 8:07 AM, Laurent wrote:
>
>
> On Thu, Sep 16, 2010 at 13:59, Isaiah Gilliland <[email protected]> wrote:
> I know many programs that accept input while calling the program like:
> "program -o option" I'd really like to use this for my next few projects but
> I'm not even really sure where to even look for information. I've been
> scouring the racket I/O docs and even the r6rs docs, but haven't found
> anything for this in the I/O sections. I've tried playing around with
> creating input ports and everything but they don't get the parameters :/
> I was hoping there was somebody out there that can point me in the right
> direction lol
>
>
> Is `current-command-line-arguments' what you are looking for?
> You can also define a `main' function which arguments are taken from the
> command line if you call
> racket my-file.rkt --main arg1 arg2 ...
>
>
> Laurent
>
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users
_________________________________________________
For list-related administrative tasks:
http://lists.racket-lang.org/listinfo/users