## SubL Reference

E-Mail Comments to: opencyc-doc@cyc.com
Last Update: 03/28/2002
Copyright© 1996-2002 Cycorp. All rights reserved.

# How to Use this Document

SubL is a computer language built by members of Cycorp. SubL was written to support the Cyc® application, allowing it to run both under Lisp environments and as a C application generated by a SubL-to-C translator. This document describes the primitive functions of SubL.

Due to the close similarities between SubL and Common Lisp, the Table of Contents and structure of this document intentionally mirror that of

> "Common Lisp: The Language",
> 2nd Edition,
> Guy L. Steele Jr

making it easy to compare and contrast the two languages. For the most part, this document focuses only on the differences between SubL and Common Lisp.

An online version of "Common Lisp: The Language" can be found at

> `http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/clm.html` **not working**

and an index to all Common Lisp functions can be found at

> `http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/index.html` **this is working**

Each section of this document contains a link labelled "CLtL2 Reference" to the corresponding sections of the above online Common Lisp reference. The reader is strongly encouraged to consult that reference in parallel with this document.

# 0 : Table of Contents

CLtL2 Reference

- 0 : Table of Contents
- 1 : Introduction
- 2 : Data Types
- 3 : Scope and Extent
- 4 : Type Specifiers
- 5 : Program Structure
  - 5.3.1 : Defining Named Functions
  - 5.3.2 : Declaring Global Variables and Named Constants
- 6 : Predicates
  - 6.1 : Logical Values
  - 6.2.2 : Specific Data Type Predicates
  - 6.3 : Equality Predicates
  - 6.4 : Logical Operators
- 7 : Control Structure
  - 7.1.1 : Reference
  - 7.1.2 : Assignment
  - 7.2 : Generalized Variables
  - 7.3 : Function Invocation
  - 7.4 : Simple Sequencing
  - 7.5 : Establishing New Variable Bindings
  - 7.6 : Conditionals
  - 7.7 : Blocks and Exits
  - 7.8.2 : General Iteration
  - 7.8.3 : Simple Iteration Constructs
  - 7.8.4 : Mapping
  - 7.10.1 : Constructs for Handling Multiple Values
  - 7.10.2 : Rules Governing the Passing of Multiple Values
  - 7.11 : Dynamic Non-Local Exits
- 8 : Macros
  - 8.1 : Macro Definition
  - 8.3 : Destructuring
  - 8.5 : Environments
- 9 : Declarations
  - 9.1 : Declaration Syntax
  - 9.2 : Declaration Specifiers
- 10 : Symbols
  - 10.1 : The Property List
  - 10.2 : The Print Name
  - 10.3 : Creating Symbols
- 11 : Packages
- 12 : Numbers
  - 12.2 : Predicates on Numbers
  - 12.3 : Comparisons on Numbers
  - 12.4 : Arithmetic Operations
  - 12.5 : Irrational and Transcendental Functions
  - 12.6 : Type Conversions and Component Extractions on Numbers
  - 12.7 : Logical Operations on Numbers
  - 12.8 : Byte Manipulation Functions
  - 12.9 : Random Numbers
  - 12.10 : Implementation Parameters
- 13 : Characters
  - 13.1 : Character Attributes
  - 13.2 : Predicates on Characters
  - 13.3 : Character Construction and Selection
  - 13.4 : Character Conversions
- 14 : Sequences
  - 14.1 : Simple Sequence Functions
  - 14.2 : Concatenating, Mapping and Reducing Sequences
  - 14.3 : Modifying Sequences
  - 14.4 : Searching Sequences for Terms
  - 14.5 : Sorting and Merging
- 15 : Lists
  - 15.1 : Conses
  - 15.2 : Lists
  - 15.3 : Alteration of List Structure
  - 15.4 : Substitution of Expressions
  - 15.5 : Using Lists as Sets
  - 15.6 : Association Lists
- 16 : Hash Tables
  - 16.1 : Hash Table Functions
  - 16.2 : Primitive Hash Function
- 17 : Arrays
  - 17.1 : Vector Creation
  - 17.2 : Vector Access
- 18 : Strings
  - 18.1 : String Access
  - 18.2 : String Comparison
  - 18.3 : String Construction and Manipulation
- 19 : Structures
- 20 : The Evaluator
  - 20.1 : Run-Time Evaluation of Forms
  - 20.2 : The Top-Level Loop
- 21 : Streams
  - 21.1 : Standard Streams
  - 21.2 : Creating new Streams
  - 21.3 : Operations on Streams
- 22 : Input/Output
  - 22.1 : Printed Representation of SubL Objects
  - 22.1.3 : Macro Characters
  - 22.1.4 : Standard Dispatching Macro Character Syntax
  - 22.1.5 : The Readtable
  - 22.1.6 : What the Print Function Produces
  - 22.2.1 : Input from Character Streams
  - 22.2.2 : Input from Binary Streams
  - 22.3.1 : Output to Character Streams
  - 22.3.2 : Output to Binary Streams
  - 22.3.3 : Formatted Output to Character Streams
- 23 : File System Interface
  - 23.1 : File Names
  - 23.2 : Opening and Closing Files
  - 23.3 : Renaming, Deleting and Other File Operations
  - 23.4 : Loading Files
  - 23.5 : Accessing Directories
- 24 : Errors
  - 24.1 : General Error-Signalling Functions
  - 24.2 : Specialized Error-Signalling Forms and Macros
- 25 : Miscellaneous Features
  - 25.1 : The Compiler
  - 25.3 : Debugging Tools
  - 25.4.1 : Time Functions
  - 25.5 : Identity Function
- 28 : Common Lisp Object System
- SubL-Specific Features
  - SubL.1 : Signals
  - SubL.2 : System Properties
  - SubL.3 : Progress Pacifiers
  - SubL.4 : Process Manipulation
  - SubL.5 : Memory Interaction
- Index

# 1 : Introduction

CLtL2 Reference

SubL is a programming language intended to be very similar to a simplified version of Common Lisp where those features that are either complex, rarely-used, or difficult to implement in a prodecural language have been excised.

Unlike Common Lisp, SubL is not a purely functional language. Several SubL constructs can only be used procedurally. In order to emphasize this difference, the following naming convention for SubL constructs is used:

> A SubL function will have the same name as the analogous Common Lisp function if it is intended to have the exact same basic functionality. The argument list may be simplified, but the intent and use are likely to be the same.

If there is a substantial behavioral difference between a SubL function and its Common Lisp counterpart, its name will be the Common Lisp name prepended with a single character -- either "c", "p" or "f".

> "c" indicates a construct that is either only procedural or functional.
> "p" indicates the procedural version of a Common Lisp construct.
> "f" indicates the functional version of a Common Lisp construct.

A procedural construct in SubL is one which is suitable for evaluation as either one form in an explicit `PROGN` or as one form in an implicit progn, which occur in the `&body` sections of many of the procedural forms such as `CLET`, `PWHEN`, `CDOLIST` etc.

Here is a table of all the procedural constructs in SubL and the Common Lisp analog:

> SubL Procedural Construct

> Common Lisp Equivalent

> ``PROGN`` |  | `progn`
> ``PIF`` |  | `if`
> ``PWHEN`` |  | `when`
> ``PUNLESS`` |  | `unless`
> ``PCOND`` |  | `cond`
> ``PCASE`` |  | `case`
> ``CSETQ`` |  | `setq`
> ``CSETF`` |  | `setf`
> ``CINC`` |  | `incf`
> ``CDEC`` |  | `decf`
> ``CPUSH`` |  | `push`
> ``CPUSHNEW`` |  | `pushnew`
> ``CPOP`` |  | `pop`
> ``CLET`` |  | `let*`
> ``CMULTIPLE-VALUE-BIND`` |  | `multiple-value-bind`
> ``CDO`` |  | `do*`
> ``CDOLIST`` |  | `dolist`
> ``CSOME`` |  | ``
> ``CDOTIMES`` |  | `dotimes`
> ``CDOHASH`` |  | ``
> ``CCATCH`` |  | `catch`
> ``CUNWIND-PROTECT`` |  | `unwind-protect`
> ``RET`` |  | `return-from`

A functional construct in SubL is one which returns a value. Here is a table of all the functional constructs in SubL and the Common Lisp analog:

> SubL Functional Construct

> Common Lisp Equvalent

> ``CAND`` |  | `and`
> ``COR`` |  | `or`
> ``CNOT`` |  | `not`
> ``FIF`` |  | `if`
> ``FWHEN`` |  | `when`
> ``FUNLESS`` |  | `unless`

The body of a function or macro definition is considered an implicit progn, and so all forms in the body should be procedural. A function call can be used as a procedural construct. In this case, the returned value is simply ignored.

# 2 : Data Types

CLtL2 Reference

SubL has a flat type heirarchy. Each type is described in more detail in the sections about the methods for that particular type.

SubL supports these built-in Common Lisp datatypes:

> Numbers: | fixnum
> | float
> Symbols: | symbol
> Lists: | cons
> Arrays: | vector
> Characters: | character
> Strings: | string
> Hashtables: | eq hashtable
> | eql hashtable
> | equal hashtable
> | equalp hashtable
> Streams: | stream
> Functions: | function

SubL does not support these Common Lisp datatypes:

> Multi-dimensional arrays
> Packages
> Pathnames
> Random-states
> Lambda-Expressions or Closures

SubL has only special-case support for these datatypes:

> Readtables: | SubL only supports a single internal readtable

New data types can be introduced via `DEFSTRUCT`.

# 3 : Scope and Extent

CLtL2 Reference

Special variables in SubL are all (and only) those variables defined globally with `DEFVAR` or `DEFPARAMETER`. In addition, the name of each special variable must begin and end with an asterisk character : `'*'`.

Special variables have indefinite scope and dynamic extent. All other variables have lexical scope and dynamic extent

Variables are introduced via:

Function call
  A new set of variables for the formal parameters of the function are introduced. The extent of the function arguments is the duration of the function invocation.
`CLET`, `CMULTIPLE-VALUE-BIND`, `CDESTRUCTURING-BIND`
  These constructs explicitly introduce and initialize new local variables. The extent of these variables is until exit from the constuct.
`CDO`, `CDOLIST`, `CSOME`, `CDOTIMES`, `CDOHASH`
  These iteration constructs explicitly introduce and update local variables which represent the state of the iteration. The extent of these variables is until exit from the iteration construct.

When a local variable is introduced with the same name as a local variable which is already within the current scope and extent, the new variable shadows the outer variable.

The initialization of a local variable is considered to occur within the scope of the new local variable. Consequently, a variable which is shadowing an outer variable cannot be initialized in terms of the outer value. For example, this is not allowed :

>     (define foo (x)
>       (clet ((x (+ x 1)))
>         (print x))
>       (ret nil))

However, if the variable is a special variable, the `CLET` is actually introducing a binding for the special variable, not introducing a new local variable. In this case, the initialization of the binding can be a function of its current value for the variable being bound. For example, this is allowed:

>     (defvar *some-var* 1)

>     (define foo (x)
>       (clet ((*some-var* (+ *some-var* x)))
>         (print *some-var*))
>       (ret nil))

The construct `RET` must be used for a function or macro definition to return its intended result.

# 4 : Type Specifiers

CLtL2 Reference

SubL does not support type specifiers.

# 5 : Program Structure

CLtL2 Reference

Program structure in SubL mirrors that of Common Lisp almost exactly. All objects except lists and symbols are self-evaluating. This includes numbers, characters, strings, vectors and hashtables. In addition :

- Keyword symbols are self-evaluating.
- The symbols T and NIL are self-evaluating.

## 5.3.1 : Defining Named Functions

CLtL2 Reference
macro `DEFINE : (name arglist &body body)`

All functions in SubL must be named and therefore defined via the SubL construct `DEFINE`. See also the similar construct `DEFPOLYMORPHIC` which is used to define generic functions which switch off the type of the first argument.

Argument lists for user-defined function can only be of this form:

>     ( {var}* [&optional {var | ( var [initform [supplied-var]] ) }*] )

In short, SubL supports `&optional` arguments for user-defined functions but does not support `&keyword`, `&aux` or `&rest` arguments for user-defined functions.

## 5.3.2 : Declaring Global Variables and Named Constants

CLtL2 Reference
macro `DEFVAR : (variable &optional initialization documentation)`
macro `DEFPARAMETER : (variable initialization &optional documentation)`

`DEFVAR` and `DEFPARAMETER` are the SubL constructs used to define global variables. The name of each variable must begin and end with an asterisk.

SubL enforces an important distinction between these two constructs, which is described in greater detail under `WRITE-IMAGE`.
macro `DEFCONSTANT : (variable initialization &optional documentation)`

As with `DEFVAR` and `DEFPARAMETER`, the name of each named constant defined via `DEFCONSTANT` must begin and end with an asterisk.

# 6 : Predicates

CLtL2 Reference

## 6.1 : Logical Values

CLtL2 Reference

The symbols NIL and T are used to represent the logical values "true" and "false" in SubL and behave exactly as they do in Common Lisp.

## 6.2.2 : Specific Data Type Predicates

CLtL2 Reference

For the most part, the following predicates which check for specific data types behave exactly as they do in Common Lisp.
function `NULL : (x)`
function `SYMBOLP : (x)`
function `ATOM : (x)`
function `CONSP : (x)`
function `LISTP : (x)`
function `NUMBERP : (x)`
function `INTEGERP : (x)`
function `FLOATP : (x)`
function `CHARACTERP : (x)`
function `STRINGP : (x)`
function `VECTORP : (x)`
function `FUNCTIONP : (x)`
Follows the CLtL2 implementation
function `FUNCTION-SPEC-P : (x)`
Returns T IFF x is an object suitable for FUNCALL

In SubL, `FUNCTIONP` only returns T if its argument is a function object. The function `FUNCTION-SPEC-P` returns T if its argument is suitable for `FUNCALL` or `APPLY`.

## 6.3 : Equality Predicates

CLtL2 Reference

The SubL equality predicates behave exactly like their Common Lisp counterparts.
function `EQ : (x y)`
function `EQL : (x y)`
function `EQUAL : (x y)`
function `EQUALP : (x y)`

## 6.4 : Logical Operators

CLtL2 Reference

SubL logical operations only return T or NIL. Otherwise, they behave like their Common Lisp counterparts.
macro `CNOT : (x)`
macro `CAND : (&rest args)`
macro `COR : (&rest args)`

# 7 : Control Structure

CLtL2 Reference

## 7.1.1 : Reference

CLtL2 Reference

These SubL constructs behave exactly like their Common Lisp counterparts.
function `QUOTE : (data)`
macro `FUNCTION : (fspec)`
function `SYMBOL-VALUE : (x)`
function `SYMBOL-FUNCTION : (x)`
function `BOUNDP : (x)`
function `FBOUNDP : (x)`

## 7.1.2 : Assignment

CLtL2 Reference
macro `CSETQ : (var value &rest var-val-pairs)`

Since `CSETQ` is procedural in SubL, it does not return a value. Otherwise, it behaves just like `setq` in Common Lisp.

These SubL functions for setting and unsetting symbol properties behave like their Common Lisp counterparts.
function `SET : (symbol value)`
function `MAKUNBOUND : (symbol)`
function `FMAKUNBOUND : (symbol)`

## 7.2 : Generalized Variables

CLtL2 Reference
macro `CSETF : (place val)`

`CSETF` is a more restricted version of `setf` in Common Lisp. First, since it is procedural, like `CSETQ` it does not return a value. Second, there is a much more restricted set of place-specifiers which are allowable. Here is a complete table of the allowable `CSETF` forms, and their equivalent SubL expansions:

CSETF form

Equivalent SubL expansion

`(`CSETF` variable value)` |  | `(`CSETQ` variable value)`
`(`CSETF` (`AREF` vector n) value)` |  | `(`SET-AREF` vector n value)`
`(`CSETF` (`NTH` n list) value)` |  | `(`SET-NTH` n list value)`
`(`CSETF` (`CAR` cons) value)` |  | `(`RPLACA` cons value)`
`(`CSETF` (`CDR` cons) value)` |  | `(`RPLACD` cons value)`
`(`CSETF` (`GET` symbol indicator) value)` |  | `(`PUT` symbol indicator value)`
`(`CSETF` (`GETHASH` key hashtable) value)` |  | `(`SETHASH` key hashtable value)`
`(`CSETF` (`SYMBOL-VALUE` symbol) value)` |  | `(`SET` symbol value)`
`(`CSETF` (defstruct-slot object) value)` |  | `(set-defstruct-slot object value)`

In the above table, defstruct-slot refers to any structure slot accessor function which got defined via defstruct, and set-defstruct-slot refers to the corresponding setter function for the given accessor.

## 7.3 : Function Invocation

CLtL2 Reference

These functions behave like their Common Lisp counterparts.
function `APPLY : (function argument &rest arguments)`
function `FUNCALL : (function &rest args)`

The first argument to both `APPLY` and `FUNCALL` must satisfy `FUNCTION-SPEC-P`.

## 7.4 : Simple Sequencing

CLtL2 Reference
macro `PROGN : (&body body)`

In SubL, `PROGN` is procedural and therefore does not return a value. Since it is intended to be essentially procedural in Common Lisp as well, the same name is used even though they have slightly different semantics.

## 7.5 : Establishing New Variable Bindings

CLtL2 Reference
macro `CLET : (bindings &body body)`

The SubL construct `CLET` can be used to introduce new local variables or bind special variables. The variables are initialized in order just like `LET*` in Common Lisp. Since it is procedural, it does not return a value.

SubL has no counterpart to Common Lisp's `LET` construct.
macro `CPROGV : (special-vars bindings &body body)`

`CPROGV` is procedural and therefore does not return a value. Otherwise, it is equivalent to `progv` in Common Lisp.

## 7.6 : Conditionals

CLtL2 Reference
macro `PIF : (condition action else-action)`
macro `PWHEN : (condition &body body)`
macro `PUNLESS : (condition &body body)`

`PIF`, `PWHEN` and `PUNLESS` are the SubL procedural variants of `if`, `when` and `unless` from Common Lisp. For each, the condition argument must be a functional construct. Also, `PIF` takes exactly three arguments, making the action and else-actions identical in form.
macro `FIF : (condition true-value false-value)`
macro `FWHEN : (condition true-value)`
macro `FUNLESS : (condition false-value)`

`FIF`, `FWHEN` and `FUNLESS` are the SubL functional variants of `if`, `when` and `unless` from Common Lisp.
macro `PCOND : (&rest clauses)`
macro `PCASE : (test-object &body clauses)`

`PCOND` and `PCASE` are the SubL procedural equivalents of `cond` and `case` from Common Lisp.

## 7.7 : Blocks and Exits

CLtL2 Reference
macro `RET : (expression)`
SubL functions must always return a value, since C functions must return values and all SubL functions must translate into C.

`RET` is used to return a value from a function or macro definition. All functions and macro definitions behave as if an implicit

>     (ret nil)

appears at the very end of each function.

## 7.8.2 : General Iteration

CLtL2 Reference
macro `CDO : (vars endtest &body body)`
cdo is procedural. It binds its variables in sequence, as with CommonLisp do*

## 7.8.3 : Simple Iteration Constructs

CLtL2 Reference
macro `CDOLIST : ((var listform) &body body)`
macro `CSOME : ((var list endvar) &body body)`
macro `CDOTIMES : ((var integer) &body body)`
macro `CDOHASH : ((key val table) &body body)`

## 7.8.4 : Mapping

CLtL2 Reference
function `MAPCAR : (function list &rest more-lists)`
function `MAPLIST : (function list &rest more-lists)`
function `MAPC : (function list &rest more-lists)`
function `MAPL : (function list &rest more-lists)`
function `MAPCAN : (function list &rest more-lists)`
function `MAPCON : (function list &rest more-lists)`

## 7.10.1 : Constructs for Handling Multiple Values

CLtL2 Reference
function `VALUES : (value &rest more-values)`
values returns its args such that they can be bound in a dynamically enclosing multiple-value-bind. The first value is returned as well, since all SubL functions must return a value.
variable `*MULTIPLE-VALUES-LIMIT*`
macro `MULTIPLE-VALUE-LIST : (form)`
macro `CMULTIPLE-VALUE-BIND : (vars value &body body)`

## 7.10.2 : Rules Governing the Passing of Multiple Values

CLtL2 Reference

In SubL, multiple values are governed the same way that they are in Common Lisp, except that if ANY of the return statements in your function are (values ...) then all of them must be.

## 7.11 : Dynamic Non-Local Exits

CLtL2 Reference
macro `CCATCH : (tag ans-var &body body)`
ccatch is procedural, and so does not return values.
macro `CUNWIND-PROTECT : (protected-form &body body)`
function `THROW : (tag result)`

# 8 : Macros

CLtL2 Reference

## 8.1 : Macro Definition

CLtL2 Reference
macro `DEFMACRO : (name pattern &body body)`

SubL Macros are expanded at translation-time. Full Common Lisp macro support is available. However, the macro-expander must use `RET` to return the expansion.

## 8.3 : Destructuring

CLtL2 Reference
macro `CDESTRUCTURING-BIND : (pattern datum &body body)`

## 8.5 : Environments

CLtL2 Reference
function `VARIABLE-INFORMATION : (variable)`
function `FUNCTION-INFORMATION : (function)`

# 9 : Declarations

CLtL2 Reference

## 9.1 : Declaration Syntax

CLtL2 Reference
function `DECLARE : (&rest ignore)`
function `PROCLAIM : (declaration-specifier)`
macro `DECLAIM : (&rest declaration-specifiers)`

## 9.2 : Declaration Specifiers

CLtL2 Reference
function `IGNORE : (&rest values)`

The `IGNORE` function can be used to indicate that a particular variable's value is not used.

# 10 : Symbols

CLtL2 Reference
function `SYMBOLP : (x)`

## 10.1 : The Property List

CLtL2 Reference
function `GET : (symbol indicator &optional default)`
function `PUT : (symbol indicator new-value)`
function `REMPROP : (symbol indicator)`
function `SYMBOL-PLIST : (symbol)`

## 10.2 : The Print Name

CLtL2 Reference
function `SYMBOL-NAME : (symbol)`
Returns the string which is the name of SYMBOL. When called on a keyword, it returns the ":" prefix as part of the name

## 10.3 : Creating Symbols

CLtL2 Reference
function `MAKE-SYMBOL : (print-name)`
function `GENSYM : (&optional x)`
GENSYM returns new, interned symbols, which are combinations of a string prefix and a numeric suffix. It guarantees that the new symbol was not previously interned.
If the argument X is a number, the gensym counter (used to generate the suffix) is set to X before the new symbol is generated.
if the argument X is a string, the gensym prefix is set to X before the new symbol is generated.
The initial gensym counter value is 1 and the initial gensym prefix is 'G'.
function `GENTEMP : (&optional (prefix "T"))`
function `KEYWORDP : (x)`
In SubL, which does not have packages, keywords are any symbol whose name begins with ":"

# 11 : Packages

CLtL2 Reference
macro `IN-PACKAGE : (name)`
function `INTERN : (string)`
Finds and returns a symbol whose name is STRING. INTERN will create the symbol if it does not exist. Unlike Common LISP intern, the SubL version does not allow an argument to specify the package, since SubL does not support packages.
function `FIND-SYMBOL : (string)`
Finds and returns a symbol whose name is STRING. Unlike Common LISP FIND-SYMBOL, the SubL version does not allow an argument to specify the package, since SubL does not support packages.

# 12 : Numbers

CLtL2 Reference

SubL only supports fixnums and floats. Fixnums have at least 28 bits of precision.
function `NUMBERP : (x)`
function `FIXNUMP : (x)`
function `INTEGERP : (x)`
function `FLOATP : (x)`

## 12.2 : Predicates on Numbers

CLtL2 Reference
function `ZEROP : (x)`
function `PLUSP : (x)`
function `MINUSP : (x)`
function `ODDP : (x)`
function `EVENP : (x)`

## 12.3 : Comparisons on Numbers

CLtL2 Reference
function `= : (num1 num2)`
function `/= : (num1 num2)`
function `< : (num1 num2)`
function `> : (num1 num2)`
function `<= : (num1 num2)`
function `>= : (num1 num2)`

The above numeric comparison functions take exactly 2 arguments, unlike their Common Lisp counterparts which take variable numbers of arguments.
function `MAX : (num &rest numbers)`
function `MIN : (num &rest numbers)`

## 12.4 : Arithmetic Operations

CLtL2 Reference
function `+ : (&rest numbers)`
function `- : (num &rest numbers)`
function `* : (&rest numbers)`
function `/ : (num &rest numbers)`
function `INT/ : (num1 num2)`
macro `CINC : (place &optional (delta 1))`
macro `CDEC : (place &optional (delta 1))`

## 12.5 : Irrational and Transcendental Functions

CLtL2 Reference

SubL does not currently support any irrational, transcendental or trigonometric functions.

## 12.6 : Type Conversions and Component Extractions on Numbers

CLtL2 Reference
function `FLOAT : (x)`
function `FLOOR : (x)`
function `CEILING : (x)`
function `TRUNCATE : (x)`
function `ROUND : (x)`
function `MOD : (number divisor)`
function `REM : (number divisor)`
function `SCALE-FLOAT : (float integer)`
function `INTEGER-DECODE-FLOAT : (float)`

## 12.7 : Logical Operations on Numbers

CLtL2 Reference

SubL does not currently support any logical operations on numbers.

## 12.8 : Byte Manipulation Functions

CLtL2 Reference
macro `BYTE : (size position)`
function `LDB : (bytespec integer)`
function `DPB : (newbyte bytespec integer)`

## 12.9 : Random Numbers

CLtL2 Reference
variable `*RAND-MAX*`
*rand-max* is the largest fixnum that the function random can accept.
function `SEED-RANDOM : (&optional (seed-fixnum (mod (get-internal-real-time) *rand-max*)))`
If seed-fixnum is omitted to seed-random, the internal clock is used
in an implementation specific manner.
function `RANDOM : (number)`

## 12.10 : Implementation Parameters

CLtL2 Reference
variable `*MOST-POSITIVE-FIXNUM*`
variable `*MOST-NEGATIVE-FIXNUM*`

# 13 : Characters

CLtL2 Reference
function `CHARACTERP : (x)`

## 13.1 : Character Attributes

CLtL2 Reference

SubL does not currently support any attributes for characters. A character exists for each ASCII character code between 0 and 255 inclusive. Thus, the SubL equivalent of Common Lisp's `CHAR-CODE-LIMIT` is 256.

## 13.2 : Predicates on Characters

CLtL2 Reference
function `ALPHA-CHAR-P : (char)`
function `UPPER-CASE-P : (char)`
function `LOWER-CASE-P : (char)`
function `BOTH-CASE-P : (char)`
function `DIGIT-CHAR-P : (char)`
function `ALPHANUMERICP : (char)`
function `CHAR= : (char1 char2)`
function `CHAR/= : (char1 char2)`
function `CHAR< : (char1 char2)`
function `CHAR> : (char1 char2)`
function `CHAR<= : (char1 char2)`
function `CHAR>= : (char1 char2)`
function `CHAR-EQUAL : (char1 char2)`
function `CHAR-NOT-EQUAL : (char1 char2)`
function `CHAR-LESSP : (char1 char2)`
function `CHAR-GREATERP : (char1 char2)`
function `CHAR-NOT-GREATERP : (char1 char2)`
function `CHAR-NOT-LESSP : (char1 char2)`

## 13.3 : Character Construction and Selection

CLtL2 Reference
function `CHAR-CODE : (char)`
function `CODE-CHAR : (code)`

## 13.4 : Character Conversions

CLtL2 Reference
function `CHAR-DOWNCASE : (char)`
function `CHAR-UPCASE : (char)`

# 14 : Sequences

CLtL2 Reference
function `SEQUENCEP : (x)`

## 14.1 : Simple Sequence Functions

CLtL2 Reference
function `ELT : (sequence index)`
function `SUBSEQ : (sequence start &optional end)`
function `COPY-SEQ : (sequence)`
function `LENGTH : (sequence)`
function `REVERSE : (sequence)`
function `NREVERSE : (sequence)`

## 14.2 : Concatenating, Mapping and Reducing Sequences

CLtL2 Reference
function `CCONCATENATE : (seq &rest more-seqs)`
function `CREDUCE : (function sequence &optional (start 0) end (init-value :none))`

## 14.3 : Modifying Sequences

CLtL2 Reference
function `FILL : (sequence item &optional (start 0) (end (length sequence)))`
function `REPLACE : (sequence1 sequence2 &optional (start1 0) end1 (start2 0) end2)`
function `REMOVE : (item sequence &optional (test #'eql) (key #'identity) (start 0) end count)`
function `REMOVE-IF : (test sequence &optional (key #'identity) (start 0) end count)`
function `DELETE : (item sequence &optional (test #'eql) (key #'identity) (start 0) end count)`
function `DELETE-IF : (test sequence &optional (key #'identity) (start 0) end count)`
function `REMOVE-DUPLICATES : (sequence &optional (test #'eql) (key #'identity) (start 0) end)`
function `DELETE-DUPLICATES : (sequence &optional (test #'eql) (key #'identity) (start 0) end)`
function `SUBSTITUTE : (new old sequence &optional (test #'eql) (key #'identity) (start 0) end count)`
function `SUBSTITUTE-IF : (new test sequence &optional (key #'identity) (start 0) end count)`
function `NSUBSTITUTE : (new old sequence &optional (test #'eql) (key #'identity) (start 0) end count)`
function `NSUBSTITUTE-IF : (new test sequence &optional (key #'identity) (start 0) end count)`

## 14.4 : Searching Sequences for Terms

CLtL2 Reference
function `FIND : (item seq &optional (test #'eql) (key #'identity) (start 0) end)`
function `FIND-IF : (test seq &optional (key #'identity) (start 0) end)`
function `POSITION : (item seq &optional (test #'eql) (key #'identity) (start 0) end)`
function `POSITION-IF : (test seq &optional (key #'identity) (start 0) end)`
function `COUNT : (item seq &optional (test #'eql) (key #'identity) (start 0) end)`
function `COUNT-IF : (test seq &optional (key #'identity) (start 0) end)`
function `MISMATCH : (seq1 seq2 &optional (test #'eql) (key #'identity) (start1 0) end1 (start2 0) end2)`
function `SEARCH : (seq1 seq2 &optional (test #'eql) (key #'identity) (start1 0) end1 (start2 0) end2)`

## 14.5 : Sorting and Merging

CLtL2 Reference
function `SORT : (seq predicate &optional (key #'identity))`
function `STABLE-SORT : (seq predicate &optional (key #'identity))`
function `CMERGE : (seq1 seq2 predicate &optional (key #'identity))`

# 15 : Lists

CLtL2 Reference
function `LISTP : (x)`
function `CONSP : (x)`
function `ATOM : (x)`

## 15.1 : Conses

CLtL2 Reference
function `CAR : (cons)`
function `CDR : (cons)`
function `CAAR : (cons)`
function `CADR : (cons)`
function `CDAR : (cons)`
function `CDDR : (cons)`
function `CONS : (car cdr)`
function `TREE-EQUAL : (tree1 tree2 &optional (test #'eql))`

## 15.2 : Lists

CLtL2 Reference
function `ENDP : (object)`
function `LIST-LENGTH : (list)`
function `NTH : (n list)`
function `FIRST : (list)`
function `SECOND : (list)`
function `THIRD : (list)`
function `FOURTH : (list)`
function `FIFTH : (list)`
function `SIXTH : (list)`
function `SEVENTH : (list)`
function `EIGHTH : (list)`
function `NINTH : (list)`
function `TENTH : (list)`
function `REST : (list)`
function `NTHCDR : (n list)`
function `LAST : (list &optional (n 1))`
function `LIST : (&rest objects)`
function `LIST* : (arg &rest objects)`
function `MAKE-LIST : (size &optional initial-element)`
function `APPEND : (&rest lists)`
function `COPY-LIST : (list)`
function `COPY-ALIST : (list)`
function `COPY-TREE : (tree)`
function `REVAPPEND : (list1 list2)`
function `NCONC : (&rest lists)`
function `NRECONC : (list1 list2)`
macro `CPUSH : (item place)`
macro `CPUSHNEW : (item place &optional (test '#'eql) (key '#'identity))`
macro `CPOP : (place)`
function `BUTLAST : (list &optional (n 1))`
function `NBUTLAST : (list &optional (n 1))`
function `LDIFF : (list sublist)`

## 15.3 : Alteration of List Structure

CLtL2 Reference
function `RPLACA : (cons newcar)`
function `RPLACD : (cons newcdr)`
function `SET-NTH : (n list value)`

## 15.4 : Substitution of Expressions

CLtL2 Reference
function `SUBST : (new old tree &optional (test #'eql) (key #'identity))`
function `SUBST-IF : (new test tree &optional (key #'identity))`
function `NSUBST : (new old tree &optional (test #'eql) (key #'identity))`
function `NSUBST-IF : (new test tree &optional (key #'identity))`
function `SUBLIS : (alist tree &optional (test #'eql) (key #'identity))`
function `NSUBLIS : (alist tree &optional (test #'eql) (key #'identity))`

## 15.5 : Using Lists as Sets

CLtL2 Reference
function `MEMBER : (item list &optional (test #'eql) (key #'identity))`
function `MEMBER-IF : (test list &optional (key #'identity))`
function `TAILP : (sublist list)`
function `ADJOIN : (item list &optional (test #'eql) (key #'identity))`
function `UNION : (list1 list2 &optional (test #'eql) (key #'identity))`
function `NUNION : (list1 list2 &optional (test #'eql) (key #'identity))`
function `INTERSECTION : (list1 list2 &optional (test #'eql) (key #'identity))`
function `NINTERSECTION : (list1 list2 &optional (test #'eql) (key #'identity))`
function `SET-DIFFERENCE : (list1 list2 &optional (test #'eql) (key #'identity))`
function `NSET-DIFFERENCE : (list1 list2 &optional (test #'eql) (key #'identity))`
function `SET-EXCLUSIVE-OR : (list1 list2 &optional (test #'eql) (key #'identity))`
function `NSET-EXCLUSIVE-OR : (list1 list2 &optional (test #'eql) (key #'identity))`
function `SUBSETP : (list1 list2 &optional (test #'eql) (key #'identity))`

## 15.6 : Association Lists

CLtL2 Reference
function `ACONS : (key datum alist)`
function `PAIRLIS : (keys data &optional alist)`
function `ASSOC : (item alist &optional (test #'eql) (key #'identity))`
function `ASSOC-IF : (predicate alist)`
function `RASSOC : (item alist &optional (test #'eql) (key #'identity))`
function `RASSOC-IF : (predicate alist)`

# 16 : Hash Tables

CLtL2 Reference

## 16.1 : Hash Table Functions

CLtL2 Reference
function `MAKE-HASH-TABLE : (size &optional (test #'eql) (area default-cons-area))`
function `HASH-TABLE-P : (x)`
function `GETHASH : (key table &optional default)`
function `SETHASH : (key table value)`
function `REMHASH : (key table)`
function `MAPHASH : (function table)`
function `CLRHASH : (table)`
function `HASH-TABLE-COUNT : (table)`

## 16.2 : Primitive Hash Function

CLtL2 Reference
function `SXHASH : (object)`

# 17 : Arrays

CLtL2 Reference

SubL only supports one-dimensional arrays, which are called vectors.
function `VECTORP : (x)`

## 17.1 : Vector Creation

CLtL2 Reference
function `MAKE-VECTOR : (size &optional initial-element)`
function `VECTOR : (&rest objects)`

## 17.2 : Vector Access

CLtL2 Reference
function `AREF : (vector index)`
function `SET-AREF : (vector index value)`

# 18 : Strings

CLtL2 Reference
function `STRINGP : (x)`

## 18.1 : String Access

CLtL2 Reference
function `CHAR : (string index)`
function `SET-CHAR : (string index value)`

## 18.2 : String Comparison

CLtL2 Reference
function `STRING= : (string1 string2 &optional (start1 0) end1 (start2 0) end2)`
function `STRING-EQUAL : (string1 string2 &optional (start1 0) end1 (start2 0) end2)`
function `STRING< : (string1 string2 &optional (start1 0) end1 (start2 0) end2)`
function `STRING> : (string1 string2 &optional (start1 0) end1 (start2 0) end2)`
function `STRING<= : (string1 string2 &optional (start1 0) end1 (start2 0) end2)`
function `STRING>= : (string1 string2 &optional (start1 0) end1 (start2 0) end2)`
function `STRING/= : (string1 string2 &optional (start1 0) end1 (start2 0) end2)`
function `STRING-LESSP : (string1 string2 &optional (start1 0) end1 (start2 0) end2)`
function `STRING-GREATERP : (string1 string2 &optional (start1 0) end1 (start2 0) end2)`
function `STRING-NOT-GREATERP : (string1 string2 &optional (start1 0) end1 (start2 0) end2)`
function `STRING-NOT-LESSP : (string1 string2 &optional (start1 0) end1 (start2 0) end2)`
function `STRING-NOT-EQUAL : (string1 string2 &optional (start1 0) end1 (start2 0) end2)`

## 18.3 : String Construction and Manipulation

CLtL2 Reference
function `MAKE-STRING : (size &optional (initial-element #\Space))`
function `STRING-TRIM : (char-list string)`
function `STRING-LEFT-TRIM : (char-list string)`
function `STRING-RIGHT-TRIM : (char-list string)`
function `STRING-UPCASE : (string &optional (start 0) end)`
function `STRING-DOWNCASE : (string &optional (start 0) end)`
function `STRING-CAPITALIZE : (string &optional (start 0) end)`
function `NSTRING-UPCASE : (string &optional (start 0) end)`
function `NSTRING-DOWNCASE : (string &optional (start 0) end)`
function `NSTRING-CAPITALIZE : (string &optional (start 0) end)`
function `STRING : (x)`

# 19 : Structures

CLtL2 Reference
macro `DEFSTRUCT : ((name &rest options) &body slots)`
Like Common Lisp defstruct except:
(1) slot initializations are not allowed.

(2) there is a required option: (:c-structure-tag val), where
val is an integer between 128-255. If you add a new defstruct,
you must have the person who maintains the Sublisp Run-Time Library
(RTL) add the tag by hand.

(3) the only other options:
(:conc-name whatever)
(:print-function #'whatever)

the default structure print function is
default-struct-print-function : object stream depth

(4) The make constructor takes no arguments and only makes an empty structure.

(5) Reading of structures is not supported by the reader.
function `DEFAULT-STRUCT-PRINT-FUNCTION : (object stream depth)`
macro `PRINTING-OBJECT : ((object stream) &body body)`

# 20 : The Evaluator

CLtL2 Reference

## 20.1 : Run-Time Evaluation of Forms

CLtL2 Reference
function `EVAL : (form)`
function `CONSTANTP : (object &optional env)

The Common Lisp functions `evalhook and `applyhook are not supported in SubL.

## 20.2 : The Top-Level Loop CLtL2 Reference
variable `*
variable `**
variable `***

For convenience, the top-level readloop binds the following variables after each form is evaluated:

* the last value returned ** the previous value of * *** the previous value of **

# 21 : Streams CLtL2 Reference
function `STREAMP : (x)

## 21.1 : Standard Streams CLtL2 Reference
variable `*STANDARD-INPUT*
variable `*STANDARD-OUTPUT*
variable `*ERROR-OUTPUT*
variable `*NULL-OUTPUT*
A bit-sink output stream. All output is ignored

The other standard streams supported by Common Lisp are not supported by SubL.

## 21.2 : Creating new Streams CLtL2 Reference
function `OPEN-TCP-STREAM : (host port)

## 21.3 : Operations on Streams CLtL2 Reference
function `STREAMP : (x)
function `INPUT-STREAM-P : (object)
function `OUTPUT-STREAM-P : (object)
function `CLOSE : (stream)

# 22 : Input/Output CLtL2 Reference

## 22.1 : Printed Representation of SubL Objects CLtL2 Reference

## 22.1.3 : Macro Characters CLtL2 Reference

The SubL reader supports the following macro characters, whose meaning is identical to their meaning in Common Lisp :

Macro Character Reader Action

`( Begin reading a list.
`) End reading a list or a vector.
`' Read in a quoted expression.
`; Read a comment until end-of-line.
`" Begin or end reading a string.
`` Read in a backquoted expression.

In addition, the following comma-readers are supported inside of backquote :

, ,@ ,. Their behavior is identical to their Common Lisp counterparts.

## 22.1.4 : Standard Dispatching Macro Character Syntax CLtL2 Reference

`'#' is the SubL standard dispatching macro character. The SubL reader supports the following dispatch macro character sequences, whose meanings are identical to their meanings in Common Lisp :

Dispatch Sequence Reader Action

`#\( Read a character constant.
`#' Read a function constant.
`#( Begin reading a vector.
`#| Begin reading a comment section.
`|# End reading a comment section.

Additionally, SubL supports the dispatch sequence `#$ as follows :

`#$foo reads the Cyc constant whose name is `"foo"

## 22.1.5 : The Readtable CLtL2 Reference

SubL internally uses a readtable, but it is not visible to the programmer.

## 22.1.6 : What the Print Function Produces CLtL2 Reference
variable `*PRINT-ESCAPE*

## 22.2.1 : Input from Character Streams CLtL2 Reference
function `READ : (&optional (stream *standard-input*) (eof-error-p t) (eof-value :eof))
Returns FORM if read was successful.
Returns the values NIL :ERROR if there was a reader error.
Returns the values EOF-VALUE :ERROR if EOF-ERROR-P is nil and EOF occurs.
Causes an error if EOF-ERROR-P is not nil and EOF occurs.

Differences from Common Lisp:
`Numbers are only read in decimal notation with no specified radix.
`No character modifiers: only standard chars plus specials like Space, Return etc.
`The || notation and \ syntax for symbols are not supported.
function `READ-LINE : (&optional (stream *standard-input*) (eof-error-p t) (eof-value :eof))
function `READ-CHAR : (&optional (stream *standard-input*) (eof-error-p t) (eof-value :eof))
function `UNREAD-CHAR : (char &optional (stream *standard-input*))
function `READ-FROM-STRING : (string &optional (eof-error-p t) (eof-value :eof) (start 0) end)
Returns the values FORM NEW-START if read was successful.
Returns the values NIL :ERROR if there was a reader error.
Returns the values EOF-VALUE :ERROR if EOF-ERROR-P is nil and EOF occurs.
Causes an error if EOF-ERROR-P is not nil and EOF occurs.
Returns a second value which is an integer indicating the position in the string to
start reading from again or :ERROR if there was some kind of reader error.

## 22.2.2 : Input from Binary Streams CLtL2 Reference
function `READ-BYTE : (stream &optional (eof-error-p t) (eof-value :eof))

## 22.3.1 : Output to Character Streams CLtL2 Reference
function `WRITE : (object &optional (stream *standard-output*) (escape *print-escape*))
function `PRIN1 : (object &optional (stream *standard-output*))
function `PRINT : (object &optional (stream *standard-output*))
function `PRINC : (object &optional (stream *standard-output*))
function `WRITE-TO-STRING : (object &optional (escape *print-escape*))
function `PRIN1-TO-STRING : (object)
function `PRINC-TO-STRING : (object)
function `WRITE-CHAR : (char &optional (stream *standard-output*))
function `WRITE-STRING : (string &optional (stream *standard-output*) (start 0) end)
function `WRITE-LINE : (string &optional (stream *standard-output*) (start 0) end)
function `TERPRI : (&optional (stream *standard-output*))
function `FORCE-OUTPUT : (&optional (stream *standard-output*))

## 22.3.2 : Output to Binary Streams CLtL2 Reference
function `WRITE-BYTE : (integer stream)

## 22.3.3 : Formatted Output to Character Streams CLtL2 Reference
function `FORMAT : (destination control-string &rest arguments)
Format ARGUMENTS to the text stream DESTINATION according to the specifications in CONTROL-STRING. SubL format is more limited than the Common Lisp version: the only escapes allowed in the control string are: ~A ~a ~S ~s ~D ~d (with width and pad parameters optional) ~C ~c ~G ~g ~% ~~

# 23 : File System Interface CLtL2 Reference

## 23.1 : File Names CLtL2 Reference
variable `*DEFAULT-PATHNAME-DEFAULTS*
function `CONSTRUCT-FILENAME : (directory-list filename &optional extension relative?)

Pathnames are just strings in SubL. Common Lisp pathname objects are not supported.

## 23.2 : Opening and Closing Files CLtL2 Reference
function `OPEN-TEXT : (filename direction)
Attempts to open the file FILENAME. If successful, returns an 8-bit character text stream. If DIRECTION is :input, then input operations can be performed on the stream. If DIRECTION is output, then output is directed to the file FILENAME, overwriting any existing file. If DIRECTION is :append, then output is appended to the file. For either output case, a new file is created if no file named FILENAME already exists.
function `OPEN-BINARY : (filename direction)
Attempts to open the file FILENAME. If successful, returns an 8-bit binary byte stream. If DIRECTION is :input, then input operations can be performed on the stream. If DIRECTION is output, then output is directed to the file FILENAME, overwriting any existing file. If DIRECTION is :append, then output is appended to the file. For either output case, a new file is created if no file named FILENAME already exists.
macro `WITH-TEXT-FILE : ((stream filestring direction) &body body)
In the scope of a WITH-TEXT-FILE expression, the file FILESTRING is opened for character i/o and a stream to this file is created and bound to the variable STREAM. If DIRECTION is :input, then input operations can be performed on STREAM. If DIRECTION is :output, then output operations can be performed, overwriting any existing file. If DIRECTION is :append, then output is appended to an existing file.
macro `WITH-BINARY-FILE : ((stream filestring direction) &body body)
In the scope of a WITH-BINARY-FILE expression, the file FILESTRING is opened for binary i/o and a stream to this file is created and bound to the variable STREAM. If DIRECTION is :input, then input operations can be performed on STREAM. If DIRECTION is :output, then output operations can be performed, overwriting any existing file. If DIRECTION is :append, then output is appended to an existing file.

## 23.3 : Renaming, Deleting and Other File Operations CLtL2 Reference
function `RENAME-FILE : (filename new-name)
function `DELETE-FILE : (filename)
function `PROBE-FILE : (filename)
function `APPEND-FILES : (filename-1 filename-2 &optional (mode :text))
Append filename-1 to filename-2
function `FILE-WRITE-DATE : (filename)
function `FILE-AUTHOR : (filename)
function `GET-FILE-POSITION : (stream)
function `SET-FILE-POSITION : (stream n)
function `FILE-LENGTH : (stream)

## 23.4 : Loading Files CLtL2 Reference
function `LOAD : (filename)

## 23.5 : Accessing Directories CLtL2 Reference
function `DIRECTORY : (directory-name &optional include-directory)

# 24 : Errors CLtL2 Reference

## 24.1 : General Error-Signalling Functions CLtL2 Reference
variable `*ERROR-ABORT-HANDLER*
If *error-abort-handler* is non-nil, then an ABORT option is available inside ERROR and CERROR.
If chosen, then the handler is funcalled on no arguments.
variable `*ERROR-HANDLER*
If *ERROR-SIGNAL* is non-nil, then that function is called upon an error. Otherwise, the debugger is invoked.
variable `*ERROR-MESSAGE*
function `ERROR : (format-string &rest arguments)
variable `*CONTINUE-CERROR?*
function `CERROR : (continue-string format-string &rest arguments)
variable `*IGNORE-WARNS?*
If T, all warnings forms are ignored
function `WARN : (format-string &rest arguments)
variable `*IGNORE-BREAKS?*
If non-NIL, all break forms are ignored
function `BREAK : (format-string &rest arguments)

## 24.2 : Specialized Error-Signalling Forms and Macros CLtL2 Reference
variable `*IGNORE-MUSTS?*
If non-NIL, all must forms are ignored
macro `MUST : (form format-string &rest arguments)
variable `*SUSPEND-TYPE-CHECKING?*
CHECK-TYPE tests are performed iff this is non-nil
macro `CHECK-TYPE : (object pred)

# 25 : Miscellaneous Features CLtL2 Reference

## 25.1 : The Compiler CLtL2 Reference

SubL currently does not provide any compilation support.

## 25.3 : Debugging Tools CLtL2 Reference
macro `CTIME : (var &body body)
function `DEBUG : ()
Pauses execution and invokes the debugger.

## 25.4.1 : Time Functions CLtL2 Reference
variable `*EPOCH*
*epoch* is the current epoch in use, which is a universal time.
The system needs to at least be able to handle epochs back to midnight Jan 1 1970.
*epoch* is globally initialized to midnight Jan 1 1970.
All universal times are relative to *epoch*.
function `GET-UNIVERSAL-TIME : ()
function `DECODE-UNIVERSAL-TIME : (universal-time)
function `ENCODE-UNIVERSAL-TIME : (second minute hour date month year)
function `TIME-FROM-NOW : (delta)
function `TIME-HAS-ARRIVED? : (time)
function `ENCODE-TIMESTRING : (second minute hour date month year)
function `TIMESTRING : (&optional (universal-time (get-universal-time)))
timestring returns a string in the format dd/mm/yy hh:mm:ss from the
universal time given. If none is given, the current time is used.
variable `*CLOCK-GRANULARITY*
*clock-granularity* is the number of internal clock units per second.
time evals form and returns the number of internal clock units it took
to execute.
function `GET-INTERNAL-REAL-TIME : ()
function `SLEEP : (seconds)

## 25.5 : Identity Function CLtL2 Reference
function `IDENTITY : (object)

# 28 : Common Lisp Object System CLtL2 Reference
macro `DEFPOLYMORPHIC : (name lambda-list &body body)
Defines a new polymorphic function that dispatches on the type of its first argument. <body> defines a default method. The function define-method can be used to define additional methods. For example:

(defpolymorphic test (a b)
`(list a b))

(define-method test ((a cons) b)
`(cons b a))

(define-method test ((a fixnum) b)
`(+ a b))

The defpolymorphic form defines the function TEST with a default method.
`The two define-method forms specialize the behavior of TEST for lists and fixnums.

(test 'foo 'bar) => (FOO BAR)
`(test '(foo) 'bar) => (BAR FOO)
`(test 2 3) => 5
macro `DEFINE-METHOD : (name lambda-list &body body)
Defines a method for the polymorphic function <name> that runs if
<dispatch-arg> is of type <type>. The lambda list must have the same
structure as in the DEFPOLYMORPHIC call.

# SubL-Specific Features

SubL.1 : Signals
variable `*SIGNAL-MAX*
There are *signal-max* total signals available.
function `DEFAULT-SIGNAL-HANDLER : (signal)
function `INSTALL-SIGNAL-HANDLER : (signal function)

SubL.2 : System Properties
function `GET-PROCESS-ID : (&optional default)
Return the current heavyweight process id of this current SubL
program. Return DEFAULT if this cannot be determined.
function `GET-MACHINE-NAME : (&optional default)
function `GET-NETWORK-NAME : (&optional default)
function `GET-USER-NAME : (&optional default)

SubL.3 : Progress Pacifiers
variable `*SILENT-PROGRESS?*
macro `NOTING-ACTIVITY : (string &body body)
function `NOTE-ACTIVITY : ()
macro `NOTING-NUMERIC-PROGRESS : (string &body body)
function `NOTE-NUMERIC-PROGRESS : (num)
macro `NOTING-PERCENT-PROGRESS : (string &body body)
function `NOTE-PERCENT-PROGRESS : (index max)

SubL.4 : Process Manipulation
function `FORK-PROCESS : (function &optional callback output-file)
Spawn a heavyweight child process to call FUNCTION, which takes no arguments.
FUNCTION must return an integer.
CALLBACK, if provided, must be a function of one argument which is called
on the returned value within the address space of the parent process.
OUTPUT-FILE, if provided, is a file to which standard output and error are piped
while executing FUNCTION.
function `RESTART-PROCESS : (&optional world-spec init-file-pathname init-form-spec)
Restart the current heavyweight process.
WORLD-SPEC, if provided, is the filename of a world to use.
INIT-FILE-PATHNAME, if provided, is a file of initializatio forms to eval.
INIT-FORM-SPEC, if provided, is a form to execute.
The values used for these when the current process was started are used if unprovided.

SubL.5 : Memory Interaction
function `GC : (&optional level)
macro `WITH-STATIC-AREA : (&body body)
function `WRITE-IMAGE : (filename &optional do-full-gc)
Save the current state of virtual memory in a file called FILENAME.
If DO-FULL-GC is true, then a full garbage collection is
performed before writing the image. Otherwise, a dynamic
garbage collection is performed and remaining objects are
promoted to being static ones.

During the initialization of a SubL system at startup, variables defined via `DEFVAR have their initial values set via their state in the world file used at startup, ignoring the initial value specified by the code. `DEFPARAMETER variables and `DEFCONSTANT global constants have their values initialized via the code on startup.

The net result of this distinction is as follows: if a world is saved out via WRITE-IMAGE, and then used to restart a SubL system, the values of `DEFVAR variables will persist, while any changes to `DEFPARAMETER variables will be lost when they are reset to their original code-specified initial values on startup.

# Index CLtL2 Reference

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

`* function
`* variable
`** variable
`*** variable
`*CLOCK-GRANULARITY* variable
`*CONTINUE-CERROR?* variable
`*DEFAULT-PATHNAME-DEFAULTS* variable
`*EPOCH* variable
`*ERROR-ABORT-HANDLER* variable
`*ERROR-HANDLER* variable
`*ERROR-MESSAGE* variable
`*ERROR-OUTPUT* variable
`*IGNORE-BREAKS?* variable
`*IGNORE-MUSTS?* variable
`*IGNORE-WARNS?* variable
`*MOST-NEGATIVE-FIXNUM* variable
`*MOST-POSITIVE-FIXNUM* variable
`*MULTIPLE-VALUES-LIMIT* variable
`*NULL-OUTPUT* variable
`*PRINT-ESCAPE* variable
`*RAND-MAX* variable
`*SIGNAL-MAX* variable
`*SILENT-PROGRESS?* variable
`*STANDARD-INPUT* variable
`*STANDARD-OUTPUT* variable
`*SUSPEND-TYPE-CHECKING?* variable
`+ function
`- function
`/ function
`/= function
`< function
`<= function
`= function
`> function
`>= function

#### A
`ACONS function
`ADJOIN function
`ALERT-USER function
`ALPHA-CHAR-P function
`ALPHANUMERICP function
`APPEND function
`APPEND-FILES function
`APPLY function
`AREF function
`ASSOC function
`ASSOC-IF function
`ATOM function

#### B
`BOTH-CASE-P function
`BOUNDP function
`BREAK function
`BUTLAST function
`BYTE macro

#### C
`CAAR function
`CADR function
`CAND macro
`CAR function
`CCATCH macro
`CCONCATENATE function
`CDAR function
`CDDR function
`CDEC macro
`CDESTRUCTURING-BIND macro
`CDO macro
`CDOHASH macro
`CDOLIST macro
`CDOTIMES macro
`CDR function
`CEILING function
`CERROR function
`CHAR function
`CHAR-CODE function
`CHAR-DOWNCASE function
`CHAR-EQUAL function
`CHAR-GREATERP function
`CHAR-LESSP function
`CHAR-NOT-EQUAL function
`CHAR-NOT-GREATERP function
`CHAR-NOT-LESSP function
`CHAR-UPCASE function
`CHAR/= function
`CHAR< function
`CHAR<= function
`CHAR= function
`CHAR> function
`CHAR>= function
`CHARACTERP function
`CHECK-TYPE macro
`CINC macro
`CLET macro
`CLOSE function
`CLRHASH function
`CMERGE function
`CMULTIPLE-VALUE-BIND macro
`CNOT macro
`CODE-CHAR function
`CONS function
`CONSP function
`CONSTANTP function
`CONSTRUCT-FILENAME function
`COPY-ALIST function
`COPY-LIST function
`COPY-SEQ function
`COPY-TREE function
`COR macro
`COUNT function
`COUNT-IF function
`CPOP macro
`CPROGV macro
`CPUSH macro
`CPUSHNEW macro
`CREDUCE function
`CSETF macro
`CSETQ macro
`CSOME macro
`CTIME macro
`CUNWIND-PROTECT macro

#### D
`DEBUG function
`DECLAIM macro
`DECLARE function
`DECODE-UNIVERSAL-TIME function
`DEFAULT-SIGNAL-HANDLER function
`DEFAULT-STRUCT-PRINT-FUNCTION function
`DEFCONSTANT macro
`DEFINE macro
`DEFINE-METHOD macro
`DEFMACRO macro
`DEFPARAMETER macro
`DEFPOLYMORPHIC macro
`DEFSTRUCT macro
`DEFVAR macro
`DELETE function
`DELETE-DUPLICATES function
`DELETE-FILE function
`DELETE-IF function
`DIGIT-CHAR-P function
`DIRECTORY function
`DPB function

#### E
`EIGHTH function
`ELT function
`ENCODE-TIMESTRING function
`ENCODE-UNIVERSAL-TIME function
`ENDP function
`EQ function
`EQL function
`EQUAL function
`EQUALP function
`ERROR function
`EVAL function
`EVENP function

#### F
`FBOUNDP function
`FIF macro
`FIFTH function
`FILE-AUTHOR function
`FILE-LENGTH function
`FILE-WRITE-DATE function
`FILL function
`FIND function
`FIND-IF function
`FIND-SYMBOL function
`FIRST function
`FIXNUMP function
`FLOAT function
`FLOATP function
`FLOOR function
`FMAKUNBOUND function
`FORCE-OUTPUT function
`FORK-PROCESS function
`FORMAT function
`FOURTH function
`FUNCALL function
`FUNCTION macro
`FUNCTION-INFORMATION function
`FUNCTION-SPEC-P function
`FUNCTIONP function
`FUNLESS macro
`FWHEN macro

#### G
`GC function
`GENSYM function
`GENTEMP function
`GET function
`GET-CONSING-STATE function
`GET-FILE-POSITION function
`GET-INTERNAL-REAL-TIME function
`GET-MACHINE-NAME function
`GET-NETWORK-NAME function
`GET-PROCESS-ID function
`GET-STRING-FROM-USER function
`GET-UNIVERSAL-TIME function
`GET-USER-NAME function
`GETHASH function

#### H
`HASH-TABLE-COUNT function
`HASH-TABLE-P function

#### I
`IDENTITY function
`IGNORE function
`IN-PACKAGE macro
`INPUT-STREAM-P function
`INSTALL-SIGNAL-HANDLER function
`INT/ function
`INTEGER-DECODE-FLOAT function
`INTEGERP function
`INTERN function
`INTERSECTION function

#### J

#### K
`KEYWORDP function

#### L
`LAST function
`LDB function
`LDIFF function
`LENGTH function
`LIST function
`LIST* function
`LIST-LENGTH function
`LISTP function
`LOAD function
`LOG-MESSAGE function
`LOWER-CASE-P function

#### M
`MAKE-HASH-TABLE function
`MAKE-LIST function
`MAKE-STRING function
`MAKE-SYMBOL function
`MAKE-VECTOR function
`MAKUNBOUND function
`MAPC function
`MAPCAN function
`MAPCAR function
`MAPCON function
`MAPHASH function
`MAPL function
`MAPLIST function
`MAX function
`MEMBER function
`MEMBER-IF function
`MIN function
`MINUSP function
`MISMATCH function
`MOD function
`MULTIPLE-VALUE-LIST macro
`MUST macro

#### N
`NBUTLAST function
`NCONC function
`NINTERSECTION function
`NINTH function
`NOTE-ACTIVITY function
`NOTE-NUMERIC-PROGRESS function
`NOTE-PERCENT-PROGRESS function
`NOTIFY-USER function
`NOTING-ACTIVITY macro
`NOTING-NUMERIC-PROGRESS macro
`NOTING-PERCENT-PROGRESS macro
`NRECONC function
`NREVERSE function
`NSET-DIFFERENCE function
`NSET-EXCLUSIVE-OR function
`NSTRING-CAPITALIZE function
`NSTRING-DOWNCASE function
`NSTRING-UPCASE function
`NSUBLIS function
`NSUBST function
`NSUBST-IF function
`NSUBSTITUTE function
`NSUBSTITUTE-IF function
`NTH function
`NTHCDR function
`NULL function
`NUMBERP function
`NUNION function

#### O
`ODDP function
`OPEN-BINARY function
`OPEN-TCP-STREAM function
`OPEN-TEXT function
`OUTPUT-STREAM-P function

#### P
`PAIRLIS function
`PCASE macro
`PCOND macro
`PIF macro
`PLUSP function
`POSITION function
`POSITION-IF function
`PRIN1 function
`PRIN1-TO-STRING function
`PRINC function
`PRINC-TO-STRING function
`PRINT function
`PRINTING-OBJECT macro
`PROBE-FILE function
`PROCLAIM function
`PROGN macro
`PUNLESS macro
`PUT function
`PWHEN macro

#### Q
`QUOTE function

#### R
`RANDOM function
`RASSOC function
`RASSOC-IF function
`READ function
`READ-BYTE function
`READ-CHAR function
`READ-FROM-STRING function
`READ-LINE function
`REM function
`REMHASH function
`REMOVE function
`REMOVE-DUPLICATES function
`REMOVE-IF function
`REMPROP function
`RENAME-FILE function
`REPLACE function
`REPORT-ERROR function
`REST function
`RESTART-PROCESS function
`RET macro
`REVAPPEND function
`REVERSE function
`ROUND function
`RPLACA function
`RPLACD function

#### S
`SCALE-FLOAT function
`SEARCH function
`SECOND function
`SEED-RANDOM function
`SEQUENCEP function
`SET function
`SET-AREF function
`SET-CHAR function
`SET-CONSING-STATE function
`SET-DIFFERENCE function
`SET-EXCLUSIVE-OR function
`SET-FILE-POSITION function
`SET-NTH function
`SETHASH function
`SEVENTH function
`SIXTH function
`SLEEP function
`SORT function
`STABLE-SORT function
`STREAMP function
`STRING function
`STRING-CAPITALIZE function
`STRING-DOWNCASE function
`STRING-EQUAL function
`STRING-GREATERP function
`STRING-LEFT-TRIM function
`STRING-LESSP function
`STRING-NOT-EQUAL function
`STRING-NOT-GREATERP function
`STRING-NOT-LESSP function
`STRING-RIGHT-TRIM function
`STRING-TRIM function
`STRING-UPCASE function
`STRING/= function
`STRING< function
`STRING<= function
`STRING= function
`STRING> function
`STRING>= function
`STRINGP function
`SUBLIS function
`SUBSEQ function
`SUBSETP function
`SUBST function
`SUBST-IF function
`SUBSTITUTE function
`SUBSTITUTE-IF function
`SXHASH function
`SYMBOL-FUNCTION function
`SYMBOL-NAME function
`SYMBOL-PLIST function
`SYMBOL-VALUE function
`SYMBOLP function

#### T
`TAILP function
`TENTH function
`TERPRI function
`THIRD function
`THROW function
`TIME-FROM-NOW function
`TIME-HAS-ARRIVED? function
`TIMESTRING function
`TREE-EQUAL function
`TRUNCATE function

#### U
`UNION function
`UNREAD-CHAR function
`UPPER-CASE-P function
`USER-CONFIRM function

#### V
`VALUES function
`VARIABLE-INFORMATION function
`VECTOR function
`VECTORP function

#### W
`WARN function
`WITH-BINARY-FILE macro
`WITH-STATIC-AREA macro
`WITH-TEXT-FILE macro
`WRITE function
`WRITE-BYTE function
`WRITE-CHAR function
`WRITE-IMAGE function
`WRITE-LINE function
`WRITE-STRING function
`WRITE-TO-STRING function

#### X

#### Y

#### Z
`ZEROP function