[racket] Getting program options/arguments?
It is probably better to use command-line (what Jay pointed to) and,
if you do, you can pass the #:argv argument to like Eli suggests.
Robby
On Thu, Sep 16, 2010 at 8:59 AM, Eli Barzilay <eli at barzilay.org> wrote:
> On Sep 16, Matthias Felleisen wrote:
>> 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.
>
> Quick note: since this can be inconvenient to do if you're playing
> with lots of different command lines, another way to do it is to
> include it in the code:
>
> #lang racket
> (current-command-line-arguments #("hello" "1" "#t"))
> (define argv (current-command-line-arguments))
> (displayln argv)
>
> ... as long as you remember to remove it when you're done.
>
> --
> ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
> http://barzilay.org/ Maze is Life!
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users
>