문제

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
도움이 되었습니까?

해결책

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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top