# MIT/GNU Scheme 9.0.1

## Table of Contents

- MIT/GNU Scheme
- Acknowledgements
- 1 Overview
  - 1.1 Notational Conventions
    - 1.1.1 Errors
    - 1.1.2 Examples
    - 1.1.3 Entry Format
  - 1.2 Scheme Concepts
    - 1.2.1 Variable Bindings
    - 1.2.2 Environment Concepts
    - 1.2.3 Initial and Current Environments
    - 1.2.4 Static Scoping
    - 1.2.5 True and False
    - 1.2.6 External Representations
    - 1.2.7 Disjointness of Types
    - 1.2.8 Storage Model
  - 1.3 Lexical Conventions
    - 1.3.1 Whitespace
    - 1.3.2 Delimiters
    - 1.3.3 Identifiers
    - 1.3.4 Uppercase and Lowercase
    - 1.3.5 Naming Conventions
    - 1.3.6 Comments
    - 1.3.7 Additional Notations
  - 1.4 Expressions
    - 1.4.1 Literal Expressions
    - 1.4.2 Variable References
    - 1.4.3 Special Form Syntax
    - 1.4.4 Procedure Call Syntax
- 2 Special Forms
  - 2.1 Lambda Expressions
  - 2.2 Lexical Binding
  - 2.3 Dynamic Binding
  - 2.4 Definitions
    - 2.4.1 Top-Level Definitions
    - 2.4.2 Internal Definitions
  - 2.5 Assignments
  - 2.6 Quoting
  - 2.7 Conditionals
  - 2.8 Sequencing
  - 2.9 Iteration
  - 2.10 Structure Definitions
  - 2.11 Macros
    - 2.11.1 Binding Constructs for Syntactic Keywords
    - 2.11.2 Pattern Language
    - 2.11.3 Syntactic Closures
      - 2.11.3.1 Syntax Terminology
      - 2.11.3.2 Transformer Definition
      - 2.11.3.3 Identifiers
    - 2.11.4 Explicit Renaming
  - 2.12 SRFI syntax
    - 2.12.1 cond-expand (SRFI 0)
    - 2.12.2 receive (SRFI 8)
    - 2.12.3 and-let* (SRFI 2)
    - 2.12.4 define-record-type (SRFI 9)
- 3 Equivalence Predicates
- 4 Numbers
  - 4.1 Numerical types
  - 4.2 Exactness
  - 4.3 Implementation restrictions
  - 4.4 Syntax of numerical constants
  - 4.5 Numerical operations
  - 4.6 Numerical input and output
  - 4.7 Fixnum and Flonum Operations
    - 4.7.1 Fixnum Operations
    - 4.7.2 Flonum Operations
  - 4.8 Random Numbers
- 5 Characters
  - 5.1 External Representation of Characters
  - 5.2 Comparison of Characters
  - 5.3 Miscellaneous Character Operations
  - 5.4 Internal Representation of Characters
  - 5.5 ISO-8859-1 Characters
  - 5.6 Character Sets
  - 5.7 Unicode
    - 5.7.1 Wide Strings
    - 5.7.2 Unicode Representations
    - 5.7.3 Alphabets
- 6 Strings
  - 6.1 Construction of Strings
  - 6.2 Selecting String Components
  - 6.3 Comparison of Strings
  - 6.4 Alphabetic Case in Strings
  - 6.5 Cutting and Pasting Strings
  - 6.6 Searching Strings
  - 6.7 Matching Strings
  - 6.8 Regular Expressions
    - 6.8.1 Regular-expression procedures
    - 6.8.2 REXP abstraction
  - 6.9 Modification of Strings
  - 6.10 Variable-Length Strings
  - 6.11 Byte Vectors
- 7 Lists
  - 7.1 Pairs
  - 7.2 Construction of Lists
  - 7.3 Selecting List Components
  - 7.4 Cutting and Pasting Lists
  - 7.5 Filtering Lists
  - 7.6 Searching Lists
  - 7.7 Mapping of Lists
  - 7.8 Reduction of Lists
  - 7.9 Miscellaneous List Operations
- 8 Vectors
  - 8.1 Construction of Vectors
  - 8.2 Selecting Vector Components
  - 8.3 Cutting Vectors
  - 8.4 Modifying Vectors
- 9 Bit Strings
  - 9.1 Construction of Bit Strings
  - 9.2 Selecting Bit String Components
  - 9.3 Cutting and Pasting Bit Strings
  - 9.4 Bitwise Operations on Bit Strings
  - 9.5 Modification of Bit Strings
  - 9.6 Integer Conversions of Bit Strings
- 10 Miscellaneous Datatypes
  - 10.1 Booleans
  - 10.2 Symbols
  - 10.3 Cells
  - 10.4 Records
  - 10.5 Promises
  - 10.6 Streams
  - 10.7 Weak Pairs
- 11 Associations
  - 11.1 Association Lists
  - 11.2 1D Tables
  - 11.3 The Association Table
  - 11.4 Hash Tables
    - 11.4.1 Construction of Hash Tables
    - 11.4.2 Basic Hash Table Operations
    - 11.4.3 Resizing of Hash Tables
    - 11.4.4 Address Hashing
  - 11.5 Object Hashing
  - 11.6 Red-Black Trees
  - 11.7 Weight-Balanced Trees
    - 11.7.1 Construction of Weight-Balanced Trees
    - 11.7.2 Basic Operations on Weight-Balanced Trees
    - 11.7.3 Advanced Operations on Weight-Balanced Trees
    - 11.7.4 Indexing Operations on Weight-Balanced Trees
- 12 Procedures
  - 12.1 Procedure Operations
  - 12.2 Arity
  - 12.3 Primitive Procedures
  - 12.4 Continuations
  - 12.5 Application Hooks
  - 12.6 Generic Dispatch
    - 12.6.1 Generic Procedures
    - 12.6.2 Method Generators
    - 12.6.3 Dispatch Tags
- 13 Environments
  - 13.1 Environment Operations
  - 13.2 Environment Variables
  - 13.3 REPL Environment
  - 13.4 Top-level Environments
- 14 Input/Output
  - 14.1 Ports
  - 14.2 File Ports
  - 14.3 String Ports
  - 14.4 Input Procedures
  - 14.5 Output Procedures
  - 14.6 Format
  - 14.7 Custom Output
  - 14.8 Prompting
  - 14.9 Port Primitives
    - 14.9.1 Port Types
    - 14.9.2 Constructors and Accessors for Ports
    - 14.9.3 Input Port Operations
    - 14.9.4 Output Port Operations
    - 14.9.5 Blocking Mode
    - 14.9.6 Terminal Mode
  - 14.10 Parser Buffers
  - 14.11 Parser Language
    - 14.11.1 *Matcher
    - 14.11.2 *Parser
    - 14.11.3 Parser-language Macros
  - 14.12 XML Support
    - 14.12.1 XML Input
    - 14.12.2 XML Output
    - 14.12.3 XML Names
    - 14.12.4 XML Structure
- 15 Operating-System Interface
  - 15.1 Pathnames
    - 15.1.1 Filenames and Pathnames
    - 15.1.2 Components of Pathnames
    - 15.1.3 Operations on Pathnames
    - 15.1.4 Miscellaneous Pathname Procedures
  - 15.2 Working Directory
  - 15.3 File Manipulation
  - 15.4 Directory Reader
  - 15.5 Date and Time
    - 15.5.1 Universal Time
    - 15.5.2 Decoded Time
    - 15.5.3 File Time
    - 15.5.4 Time-Format Conversion
    - 15.5.5 External Representation of Time
  - 15.6 Machine Time
  - 15.7 Subprocesses
    - 15.7.1 Subprocess Procedures
    - 15.7.2 Subprocess Conditions
    - 15.7.3 Subprocess Options
  - 15.8 TCP Sockets
  - 15.9 Miscellaneous OS Facilities
- 16 Error System
  - 16.1 Condition Signalling
  - 16.2 Error Messages
  - 16.3 Condition Handling
  - 16.4 Restarts
    - 16.4.1 Establishing Restart Code
    - 16.4.2 Invoking Standard Restart Code
    - 16.4.3 Finding and Invoking General Restart Code
    - 16.4.4 The Named Restart Abstraction
  - 16.5 Condition Instances
    - 16.5.1 Generating Operations on Conditions
    - 16.5.2 Condition Abstraction
    - 16.5.3 Simple Operations on Condition Instances
  - 16.6 Condition Types
  - 16.7 Condition-Type Taxonomy
- 17 Graphics
  - 17.1 Opening and Closing of Graphics Devices
  - 17.2 Coordinates for Graphics
  - 17.3 Drawing Graphics
  - 17.4 Characteristics of Graphics Output
  - 17.5 Buffering of Graphics Output
  - 17.6 Clipping of Graphics Output
  - 17.7 Custom Graphics Operations
  - 17.8 Images
  - 17.9 X Graphics
    - 17.9.1 X Graphics Type
    - 17.9.2 Utilities for X Graphics
    - 17.9.3 Custom Operations on X Graphics Devices
  - 17.10 Win32 Graphics
    - 17.10.1 Win32 Graphics Type
    - 17.10.2 Custom Operations for Win32 Graphics
- 18 Win32 Package Reference
  - 18.1 Overview
  - 18.2 Foreign Function Interface
    - 18.2.1 Windows Types
    - 18.2.2 Windows Foreign Procedures
    - 18.2.3 Win32 API names and procedures
  - 18.3 Device Independent Bitmap Utilities
    - 18.3.1 DIB procedures
    - 18.3.2 Other parts of the DIB Utilities implementation
- Appendix A GNU Free Documentation License
  - A.1 ADDENDUM: How to use this License for your documents
- Appendix B Binding Index
- Appendix C Concept Index

Next: Acknowledgements, Previous: (dir), Up: (dir)

## MIT/GNU Scheme

This manual documents MIT/GNU Scheme 9.0.1.

Copyright © 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Massachusetts Institute of Technology

> Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Texts being “A GNU Manual,” and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled “GNU Free Documentation License.”

> (a) The FSF's Back-Cover Text is: “You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.”

--- The Detailed Node Listing ---

Overview

Notational Conventions

Scheme Concepts

Lexical Conventions

Expressions

Special Forms

Definitions

Macros

Syntactic Closures

SRFI syntax

Numbers

Fixnum and Flonum Operations

Characters

Unicode

Strings

Regular Expressions

Lists

Vectors

Bit Strings

Miscellaneous Datatypes

Associations

Hash Tables

Weight-Balanced Trees

Procedures

Generic Dispatch

Environments

Input/Output

Port Primitives

Parser Language

XML Support

Operating-System Interface

Pathnames

Date and Time

Subprocesses

Error System

Restarts

Condition Instances

Graphics

X Graphics

Win32 Graphics

Win32 Package Reference

Foreign Function Interface

Device Independent Bitmap Utilities