.rkt
is the conventional file extension for 'regular' Racket source code. In the documentation, I also see .rktl
and .rkts
being used. What are .rktl
and .rkts
used for, and are there any more Racket filename extensions I am not aware of?
The .rkt
file extension is generally used for files that represent modules. These normally have a #lang ....
line at the top, or sometimes (module ....)
. They can be imported as modules with require
.
The .rktl
and .rkts
file extensions are used for files meant to be loaded at the top-level that aren't modules. They don't necessarily have a #lang ....
line at the top, and must be loaded in some external environment with load
instead of imported with require. These usually have a more "dynamic" feel to them, and they're used more often with scripts that use mutation of variables across multiple files. This is not the "encouraged" style in Racket.
The .rktd
file extension is used for files that just have data encoded as s-expressions, not code. These files should not be required or loaded (they should not be executed as code). However, other programs use them to store data on the file system using write
, and to read the data later using read
. It's purpose is the same as a .sexp
file or a .json
file, just pure data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With