Page Contents

Some libraries written for, or converted to run in, R7RS Scheme.


A set of libraries written by myself for R7RS Scheme.

Documentation: API - examples

Library Name Description

(robin abbrev)

Creates a set of unambiguous abbreviations for strings (based on Ruby’s Abbrev class).

(robin confusion-matrix)

Supports incremental construction of a confusion matrix, and calculation of common quantitative statistics.

(robin csv)

Read/write csv files, according to RFC4180.

(robin disjoint-set)

Data structure to hold sets of items in disjoint sets.

(robin simulated-annealing)

Stochastic optimisation algorithm.

(robin srfi64-utils)

Helper functions for SRFI 64 testing.

(robin statistics)

Descriptive statistical functions.

(robin text)

Formatting, similarity measures etc for text data.


A repackaging of the Natural Language ToolKit, originally written for R6RS Scheme.

Documentation: API - paper

Library Name Description

(nltk dfsa)

Implementation of Deterministic Finite-State Automaton.

(nltk lang-en)

English stop words.

(nltk lang-hr)

Croatian stop words.

(nltk n-grams)

Functions for creating and working with n-grams.

(nltk sequence)

Support functions for generating or working with sequences.

(nltk vectorspace)

Data structure for vectors, supporting operations like dot-product, cosine-similarity, etc.

(not cgi, as required R6RS libraries not present)


A repackaging of Purely Functional Data Structures, originally written for R6RS Scheme.

Documentation: API

Library Name Description

(pfds bounded-balance-tree)

An ordered set, represented as a balanced tree.

(pfds deque)

Double-ended queue.

(pfds difference-list)

Representation of a list with constant time append to either the front or end.

(pfds fector)

Functional vector - from

(pfds fingertree)

A generalised form of "deque".

(pfds hash-array-mapped-trie)

Similar to a hash-table, but with more efficient space requirements.

(pfds heap)

An ordered set, represented as a heap.

(pfds priority-search-queue)

Supports access, insertion, removal and update on arbitrary keys, as well as easy removal of the element with the lowest priority.

(pfds queue)

A simple queue structure, supported addition/removal from one end.

(pfds sequence)

General-purpose, variable-length collection, with efficient addition and removal from both ends and random-access.

(pfds set)

An ordered set, implemented internally using a bounded-balance tree.


A repackaging of some smaller libraries, containing a single or few files, ported from various sources.

Documentation: examples

Library Name Description

(rebottled cl-pdf) (rebottled cl-pdf-utils)

Port of a Common Lisp library for writing PDF files.

(rebottled pregexp)

Dorai Sitaram’s portable regular expressions for Scheme:

(rebottled pstk)

A scheme-tcltk bridge, used to create GUI programs.

(rebottled pstk-plotchart)

Requires 'tklib', supports graph plotting.


SLIB is a long-established library containing around 30,000 lines of Scheme code, working with many Scheme implementations. The version here repackages as much of SLIB (version 3b5) as possible into reusable R7RS libraries, and includes many tests and examples.

All libraries are imported as (import (slib NAME)) in place of (require 'NAME), and function/variable names are preserved in most cases, so the original documentation can still be used. (The README accompanying the source code describes the changes in more detail.)

Documentation: slib - selected examples

Library Name Description

(slib alist-table)

Database tables using association lists.

(slib alist)

Functions to treat a list of key-value pairs as an associative database.

(slib array-for-each)

Applicative routines for arrays.

(slib array-interpolate)

Interpolate array access.

(slib byte-number)

Byte integer and IEEE floating-point conversions.

(slib byte)

Arrays of small integers.

(slib chapter-order)

Chapter ordering of strings.

(slib charplot)

Plotting on character devices.

(slib coerce)

Implementation of common-lisp coerce and type-of.

(slib collect)

Collection operations.

(slib color-names)

Colour name databases.

(slib color-space)

Colour space conversions.

(slib color)

Colour data type.

(slib common-lisp-time)

Common lisp time conversion routines.

(slib common-list-functions)

Some common lisp list functions.

(slib common)

Common functions, usually defined in slib’s init file.

(slib commutative-ring)

Extends Scheme numerics to any commutative ring.

(slib crc)

Compute cycle checksums.

(slib database-browse)

Relational database browser.

(slib database-commands)

Embed commands in a relational database.

(slib database-interpolate)

Interpolate function from database table.

(slib databases)

Relational database utilities.

(slib daylight)

Model of sun and sky colours.

(slib db-html)

Convert relational databse to hyperlinked pages.

(slib determinant)

Matrix algebra.

(slib diff)

Sequence comparison algorithm.

(slib directory)


(slib dynamic)

Dynamic datatype.

(slib eps-graph)

Create postscript graphs.

(slib factor)

Factorisation, prime test and generation.

(slib filename)

String matching for filenames (like bash).

(slib format)

Common lisp text output formatter.

(slib fourier-transform)

Discrete Fourier transform.

(slib generic-write)

Used by pretty-print and truncated-print.

(slib getopt-parameters)

Convert getopt to passing parameters by name.

(slib getopt)

POSIX command argument processing.

(slib hash)

Hashing functions.

(slib hilbert-fill)

Hilbert space-filling mapping.

(slib html-for-each)

HTML scan calls procedures for word, tag, whitespace and newline.

(slib html-form)

Generate HTML-2.0 forms.

(slib http)

Service HTTP or CGI requests.

(slib limit)

One-side limit algorithm.

(slib line-io)

Line oriented input/output functions.

(slib math-integer)

Mathematical functions restricted to exact integers.

(slib math-real)

Mathematical functions restricted to real numbers.

(slib metric-units)

Implements "Representation of numerical values and SI units in character strings for information interchanges" -

(slib minimize)

Finds minimum f(x) for x0 ⇐ x ⇐ x1

(slib modular)

Modular fixnum arithmetic.

(slib nbs-iscc)

NBS/ISCC Colour System.

(slib ncbi-dna)

Read and manipulate NCBI-format nucleotide sequences.

(slib object-string)

Write objects to a string.

(slib object)

Macroless object system.

(slib parameters)

Passing parameters by name.

(slib peano-fill)

Peano space-filling mapping.

(slib pnm)

Read and write PNM image files.

(slib posix-time)

POSIX time-conversion routines.

(slib pprint-file)

Pretty-print a Scheme file.

(slib precedence-parse)

Dynamically extensible parser/tokeniser.

(slib pretty-print)

Pretty-print scheme values.

(slib printf)

Implementation of standard C function.

(slib priority-queue)

Priority queue data structure.

(slib queue)

Queue/stack data structure.

(slib random-inexact)

Pseudo-random inexact real numbers.

(slib rationalize)

Find simplest number ratios.

(slib read-command)

Break command-line into arguments.

(slib relational-database)

Relational-database system.

(slib resene)

Resene RGB values list.

(slib rev2-procedures)

Some procedures from R2RS.

(slib root)

Newton’s and Laguerre’s methods for finding roots.

(slib saturate)

Saturated-Colours dictionary.

(slib scanf)

Implementation of formatted input.

(slib schmooz)

Program for extracting texinfo commends from Scheme.

(slib sierpinski)

Hash function for 2D data which preserves nearness.

(slib solid)

Solid modelling with VRML97.

(slib soundex)

Original soundex algorithm.

(slib space-filling)

Space-filling functions and their inverses.

(slib string-case)

String casing functions.

(slib string-port)

String ports.

(slib string-search)

Search for string from port.

(slib subarray)

Array accessory procedures.

(slib time-core)

Core time conversion routines.

(slib time-zone)

Compute timezones and DST from TZ environment variable.

(slib topological-sort)

Topological sort.

(slib transact)

Interface to programs.

(slib tree)

Implementation of common lisp tree functions.

(slib tzfile)

Read sysV style (binary) timezone file.

(slib uri)

Construct and decode Uniform Resource Identifiers.

(slib within-database)

Syntactic extensions for RDMS.

(slib wt-tree)

Weight balanced trees.

(slib xml-parse)

XML parsing and conversion to SXML.

(slib yasos)

Yet Another Scheme Object System.


Library Name Description

(srfi 63)

Homogeneous and Heterogeneous Arrays
Array library required for slib

(srfi 210)

Procedures and syntax for multiple values.


The following libraries are provided specifically for Kawa. These are in part needed to support the remaining libraries, but also improve support for R7RS-large.

Library Name Description

(scheme bitwise)

Bitwise operations.

(scheme box)


(scheme charset)

Character-set library.
Wrapper around the built-in (srfi 14).

(scheme comparator)

Comparators (reduced).

(scheme division)

Integer division.

(scheme hash-table)

Intermediate hash tables.
Wrapper around the built-in (srfi 69).

(scheme ideque)

Immutable deques.

(scheme ilist)

Immutable list library.

(scheme list)

List library.
Wrapper around the built-in (srfi 1).

(scheme list-queue)

Queues based on lists.

(scheme rlist)

Purely-functional random-access lists and pairs.
Wrapper around the built-in (srfi 101), with appropriate renaming. Does not include rquote.

(scheme set)

Sets and bags.

(scheme sort)

Sort libraries.
Does not include list-stable-sort.

(scheme stream)

Wrapper around the built-in (srfi 41).

(scheme vector)

Vector library.

(srfi 27)

Sources of random bits

(srfi 31)

A special form rec for recursive evaluation.

(srfi 152)

String library (reduced)

(srfi 195)

Multiple-value boxes
Required by (srfi 210)


The following libraries are provided specifically for Sagittarius.

Library Name Description

(srfi 195)

Multiple-value boxes
Required by (srfi 210)