Question

When I develop python, I often use python -i filename.py to run the file, and then go into interactive mode in the namespace of the given file, so e.g. if I had defined C=3, I could then access it from the prompt as

>>> C
3

I'm trying to find a way to use the racket command line program in a similar way, but the closest I've gotten is

$ racket -i -e "(require \"filename.rkt\")"
> C
3
Was it helpful?

Solution

I figured it out

racket -it filename.rkt
> C
3

or

racket -iu filename.rkt
> C
3

Not really sure what the differences are, but the command line help says the following

-t <file>, --require <file> : Like -e '(require (file "<file>"))' [*]
-u <file>, --require-script <file> : Same as -t <file> -N <file> --
-N <file>, --name <file> : Sets `(find-system-path 'run-file)' to <file>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top