scheme
Run programs written in the Scheme language
TLDR
Start a REPL (interactive shell)
Run a scheme program (with no REPL output)
Load a scheme program into the REPL
Load scheme expressions into the REPL
Open the REPL in quiet mode
SYNOPSIS
scheme [OPTIONS] [FILE [ARGUMENTS...]]
PARAMETERS
FILE
Specifies a Scheme source file to be executed. The interpreter will typically read and run the code in this file.
-i, --interactive
Starts the interpreter in interactive mode (REPL) after processing any specified files or expressions. This is often the default if no file or expression is provided.
-e
Evaluates the given Scheme expression directly from the command line. This is useful for short, one-off computations or for passing data to a script.
-l
Loads and executes the specified Scheme file. This can be used to load libraries or define functions before running other code or entering the REPL.
-v, --version
Displays the version information of the Scheme interpreter.
-h, --help
Displays a help message with available command-line options and usage information.
--
Used to separate command-line options from arguments that should be passed directly to the Scheme program being executed. Arguments after '--' are typically accessible by the Scheme script.
--quiet, -q
Suppresses startup messages and banners, leading to a quieter execution environment.
DESCRIPTION
The scheme command typically refers to an executable for a Scheme interpreter, a program that executes code written in the Scheme programming language. Scheme is a dialect of Lisp, known for its minimalist design, powerful expressiveness, and emphasis on functional programming paradigms. While there isn't a single universal "scheme" command installed by default on all Linux distributions, this name often serves as a symbolic link or a common choice for a specific Scheme implementation (e.g., Guile, Racket, MIT/GNU Scheme, Chicken Scheme) to provide a generic entry point.
When invoked, the scheme command can be used in several ways: to run a Scheme script from a file, to evaluate a single Scheme expression directly from the command line, or to enter an interactive Read-Eval-Print Loop (REPL). In a REPL, users can type Scheme expressions and see their results immediately, making it an excellent environment for experimenting with the language, debugging, and interactive development. The exact features, command-line options, and behavior depend heavily on the specific Scheme interpreter installed and invoked.
CAVEATS
The specific `scheme` command and its available options are highly dependent on which Scheme interpreter is installed on the system (e.g., Guile, Racket, MIT/GNU Scheme, Chicken Scheme). Some systems may not have a generic `scheme` executable at all, requiring the user to invoke the specific interpreter directly (e.g., `guile`, `racket`). Functionality and adherence to the Scheme standard (RnRS) can vary between implementations.
INTERACTIVE REPL
When run without arguments or with an explicit interactive flag, the Scheme interpreter enters a Read-Eval-Print Loop (REPL). This allows users to type Scheme expressions directly, have them evaluated, and see the results immediately. It's an essential tool for exploratory programming, quick tests, and debugging.
SCRIPT EXECUTION
Scheme files (often with a `.scm` or `.ss` extension) can be made executable using a shebang line (e.g., `#!/usr/bin/env scheme` or `#!/usr/bin/guile`) at the top of the script. This allows them to be run directly like other shell scripts, making Scheme a viable language for system scripting tasks.
LANGUAGE FEATURES
Scheme is known for its powerful features like first-class functions (functions that can be passed as arguments, returned from other functions, and assigned to variables), continuations (representing the entire future of a computation), and a robust macro system for extending the language itself. It adheres to a strict standard, ensuring portability across different implementations to a degree.
HISTORY
Scheme was created by Guy L. Steele Jr. and Gerald Jay Sussman in 1975, primarily as a vehicle for studying various theoretical aspects of programming languages. It was the first dialect of Lisp to introduce lexical scoping and continuations, which are now common features in many programming languages. Its design principles emphasize simplicity and elegance, making it an influential language in computer science education and research. While various implementations have existed over the decades, a common `scheme` command on Linux typically emerged from users creating symbolic links to their preferred interpreter, rather than a single, universally adopted `scheme` binary. The standardization of Scheme itself is managed by a series of 'Revisedn Report on the Algorithmic Language Scheme' (RnRS) documents, with R7RS being the latest.