Executing Racket Getting Started Student Scripts in Terminal Without Packing into a Module
I am trying to execute a script written in one of the learning languages (for example a novice learner) that comes with the DrRacket framework.
I can achieve this by wrapping the code in a module (as DrRacket does):
#reader(lib "htdp-beginner-reader.ss" "lang")((modname my_module) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))
;; my code goes here
However, it would be much preferable for me not to turn my code into a module. Is it possible to achieve this by passing command line arguments (or any other way)?
source to share
You can use something like #lang htdp/bsl
. The list that I can see, available asl
, bsl
, bsl+
, isl
and isl+
. If you know the language it should be in, you can use this, perhaps a short script, to add this to the temp file before launching (I assume you are using the command line racket and not DrRacket, since in DrRacket you can just select a language in the lower left corner to select the correct language).
I haven't been able to find a way to set up the racket executable to overlay the language at the start. Hopefully someone else comes along to explain how the -I
language should be installed because I couldn't figure it out.
source to share