[racket] Getting program options/arguments?
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!