What's the proper scheme file extension?

There is no proper Scheme extension. I've browsed through R[567]RS and it is not specified.

This is deliberate as the Appendix F in a R6RS Non-Normative Appendices draft (PDF) actually had a part about mapping from library path to file paths which didn't make the final spec.

With that said, the most common file extension for Scheme programs is .scm and there have been other extensions added in R6RS and perhaps R7RS by implementers to distinguish library from main programs.

In fact the only thing that the implementations need to assure is that there is a way to "install" a library and that is usually a file that needs to map to the library name in the source code. In Racket's R6RS this is done by an installation program:

plt-r6rs --install test.xxx 
[installing /home/westerp/.racket/6.4/collects/examples/hello.ss]
[Compiling /home/westerp/.racket/6.4/collects/examples/hello.ss]

So in fact for racket it accepts any file name/extension without question, but it uses .ss as extension for R6RS and it looks for .sls and .scm files as well should you manually do what the plt-r6rs --install does by hand.

Other implementations might require a manual ways to install a library but it is still nothing to do with the Scheme language since the specification left this part out to be solved by the implementations.


Here's a list of all the Scheme-related file name extensions I've encountered. After each extension is a guess of its expansion in quotes. If some information is wrong or missing, please comment.

Common extensions for Scheme

.scm ("Scheme") -- Scheme source code written for R5RS, R6RS, R7RS, or any other implementation and standard. This is the most common and generally preferred extension for Scheme source files.

.sps ("Scheme program source") -- A R6RS Scheme program. Not really different from .scm as far as I can tell, but I guess this extension signifies that the file contains a main program and hence its name can be passed to a Scheme interpreter to run the program.

.sls ("Scheme library source") -- A R6RS (library ...) form which contains both interface declarations and the library implementation. You'll find these in Akku packages, for example.

.sld ("Scheme library definition") -- A R7RS (define-library ...) form. That form tends to contain mostly declarations, using (include ...) to include the actual .scm source files of the library. You'll these in Snow packages, for example.

Extensions for Scheme-derived languages

.rkt ("Racket") -- Racket source code. Racket supports R6RS Scheme, R7RS Scheme (through a third-party package), its own dialect (also called Racket) which has now expanded quite a bit from R6RS, and quite a few languages that have little or nothing to do with Scheme. Each .rkt file starts with a line like #lang racket/base to say which language that file is written in.

.scr ("Scribe") -- A text document written in Scheme Scribe, a markup language similar in spirit to TeX/LaTeX but with Scheme as the macro language. Note: The original Scribe markup language from 1980 did not use Scheme.

.scrbl("Scribble") -- A text document written in Scribble, a modern version of Scheme Scribe. Scribble interpreters have been implemented for at least Racket and Chibi Scheme.

Rare extensions for Scheme

.ss ("Scheme source") -- Rare equivalent to .scm. Spotted in the source code of some R6RS implementations.

.sc ("Scheme") -- Rare equivalent to .scm.

.sch ("Scheme") -- Spotted in the source code of the Larceny implementation.

.sps7 ("Scheme program source (R7RS)") -- A R7RS Scheme program. Spotted in the source code of the Larceny implementation.

Tags:

Scheme