Implementations, Installation and the REPL

2.1 Major Implementations

Chez Scheme Very fast native compiler (Cisco, open source since 2016) R6RS (+ R7RS via libraries)

GNU extension language, rich libraries, Guix R5RS/R6RS/most of R7RS

Compiles to C, huge "eggs" library ecosystem Compiles to C/JavaScript, fast, good for embedding

Small, embeddable, the R7RS reference-ish implementation Practical scripting, fast startup MIT/GNU Scheme

SICP's home, native compiler, Edwin editor Huge ecosystem; #lang r5rs, #lang r6rs, #lang r7rs (via package) Its own dialect + standards

Cyclone, Loko, STklos, Sagittarius, Larceny, Ypsilon BiwaScheme, LIPS In-browser (JavaScript) Hoot (Spritely) Guile → WebAssembly compiler

2.2 Installing

# Chez Scheme
brew install chezscheme            # macOS
sudo apt install chezscheme        # Debian/Ubuntu
# GNU Guile
sudo apt install guile-3.0         # Linux
brew install guile                 # macOS
# Chibi-Scheme
brew install chibi-scheme
# CHICKEN
sudo apt install chicken-bin
# Racket (then: raco pkg install r7rs)
brew install --cask racket

2.3 The REPL

scheme          # Chez (or chez / chezscheme depending on the package)
guile           # Guile
chibi-scheme    # Chibi
csi             # CHICKEN interpreter (csc compiles)
racket          # Racket
> (+ 1 2)
3
> (define (square x) (* x x))
> (square 12)
144
> (exit)

2.4 Hello, World

Editors: Emacs + Geiser (REPL integration for Guile, Chez, Chicken, Chibi, Gambit, MIT, Racket), paredit/smartparens, DrRacket, VS Code + Magic Racket.

;; hello.scm (R7RS program)
(import (scheme base) (scheme write))

(display "Hello, World!")
(newline)

(define name "Scheme")
(display (string-append "Hello, " name "!"))
(newline)
chibi-scheme hello.scm
guile hello.scm
scheme --script hello.scm          # Chez (use (import (chezscheme)) or R6RS imports for Chez)
csi -s hello.scm                   # CHICKEN
racket hello.scm                   # with #lang r7rs at the top