Programming Language Eulisp

Version

Programming Language EuLisp version

Contents Page

Foreword

Intro duction

Language Structure

Scop e

Conformance Denitions

Error Denitions

Compliance

Conventions

Layout and Typ ography

MetaLanguage

Naming

Denitions

Syntax

Whitespace and Comments

Ob jects

Mo dules

Directives

Exp ort Directive

Imp ort Directive

Exp ose Directive

Syntax Directive

Denitions and Expressions

Mo dule Pro cessing

Mo dule Denition

Ob jects

System Dened Classes

Single Inheritance

Dening Classes

Dening Generic Functions and Metho ds

Sp ecializin g Metho ds

Metho d Lo okup and Generic Dispatch

Creating and Initializi ng Ob jects

Accessing Slots

Concurrency

Threads

Lo cks

Conditions

Condition Classes

Condition Handling ii

Programming Language EuLisp version

Expressions Denitions and Control Forms

Simple Expressions

Functions creation denition and application

Destructive Op erations

Conditional Expressions

Variable Binding and Sequences

Events

Quasiquotation Expressions

Summary of Level Expressions and Denitions

Syntax of Level dening forms

Syntax of Level expressions

Syntax of Level macros

Annexes

ALevel Mo dule Library

A Characters

A Collections

A Comparison

A Conversion

A Copying

A Double Precision Floats

A Elementary Functions

A Floating Point Numbers

A Fixed Precision Integers

AFormattedIO

AIntegers

ALists

ANumbers

AStreams

AStrings

ASymbols

ATables

AVectors

ASyntax of Level ob jects

B Programming Language EuLisp Level

B Classes and Ob jects

B Generic Functions

B Metho ds

B Ob ject Introsp ection

B Class Introsp ection

B Slot Introsp ection

B Generic Function Introsp ection

B Metho d Introsp ection

B Class Initializa tion

B Slot Description Initializa tion

B Generic Function Initializ ation

B Metho d Initializati on

B Inheritance Proto col

B Slot Access Proto col

B Metho d Lo okup and Generic Dispatch

B LowLevel Allo cation Primitives

B Dynamic Binding

B Exit Extensions

B Summary of Level Expressions and Denitions

B Syntax of Level dening forms

B Syntax of Level expressions

B Syntax of Level macros

Indexes

Class Index

Condition Index

ConstantIndex

Function Index

Macro Index

Generic Function Index

Metho d Index iii

Programming Language EuLisp version

General Index

Figures

Example of mo dule directives

Example mo dule using expose

Level initial class hierarchy

Level initial condition class hierarchy

Illustration of handler actions

Example using letcc

Interaction of unwindprotect with nonlo cal exits

A Level numb er class hierarchy

B Level class hierarchy

B Initializati on Call Structure

Tables

Mo dules comprising level

Minimal character set

Syntax of ob jects for reading and writing

Mo dule syntax

defstruct syntax

defgeneric rewrite rules

A Character Syntax

A Summary of comparison functions

A Floating Point Syntax

A Integer Syntax

A Pair and List Syntax

A Examples of string literals

A String Syntax

A IdentierSymb ol Syntax

A Vector Syntax iv

COMMITTEE DRAFT Programming Language EuLisp version

Programming Language EuLisp version

In the b eginning the work of the EULISP group was sup

p orted by the institutions or companies where the partici

pants worked but in DG XI I I Information technol

ogy directorate of the Commission of the Europ ean Com

munities agreed to supp ort the of the work

ing group by funding meetings and providing places to

meet It can honestly b e said that without this supp ort

EULISP would not have reached its presentstate In ad

dition the EULISP group is grateful for the supp ort of

British Council in France Alliance programme British

Council in Spain Acciones Integradas programme British

Council in Germany Academic Research Collab oration pro

gramme British Standards Institute Deutscher Akademis

cher Austauschdienst DAAD Departament de Llenguat

ges i Sistemes Informatics LSI Universitat Politecnica de

Catalunya Fraunhofer Gesellschaft Institut fur Software

Foreword

und Systemtechnik Gesellschaft fur Mathematik und Daten

verarb eitung GMD ILOG SA Insiders GmbH Institut

The EULISP group rst met in Septemb er at IRCAM

National de Recherche en Informatique et en Automatique

in Paris to discuss the idea of a new dialect of Lisp which

INRIA Institut de Recherche et de Co ordination Acous

should b e less constrained by the past than

tique Musique IRCAM Rank XeroxFrance Science and

and less minimalis than Scheme Subsequent meetings for

Engineering Research Council UK Siemens AG University

mulated the view of EULISP that was presented at the

of Bath UniversityofTechnology Delft University of Edin

ACM Conference and held

burgh Universitat Erlangen and UniversiteParis VI LITP

at MIT Cambridge Massachusetts and at the Euro

p ean Conference on Articial Intelligence ECAI held

The following p eople in alphab etical order have con

in Brighton Sussex Since then progress has not b een

tributed in various ways to the evolution of the language

steady but happ ening as various p eople had sucient time

ejar Russell Bradford Harry Giusepp e Attardi Javier B

and energy to develop part of the language Consequently

Bretthauer Peter Broadb ery Christopher Burdorf Jerome

although the vision of the language has in the most part

Chailloux Thomas Christaller Je Dalton Klaus Daler

b een shared over this p erio d only certain parts were turned

Harley Davis David DeRoure John Fitch Richard Gabriel

into physical descriptions and implementations For a nine

Brigitte Glas Nicolas Graub e Dieter Kolb Jurgen Kopp

month p erio d starting in January through the supp ort

Antonio Moreno Eugen Neidl Pierre Parquier Keith Play

of INRIA it b ecame p ossible to start writing the EULISP

ford Willem van der Po el Christian Queinnec Enric Sesa

denition Since then aairs have returned to their previ

Herb ert Stoyan and Richard Tobin

ous state but with the evolution of the implementation s of

EULISP and the background of the foundations laid by the

The editors of the EULISP denition wish particularly to ac

INRIAsupp orted work there is convergence to a consistent

knowledge the work of Harley Davis on the rst versions of

and practical denition

the description of the ob ject system The second version was

largely the work of Harry Bretthauer with the assistance of

The acknowledgments for this denition fall into three cate

Jurgen Kopp Harley Davis and Keith Playford

gories intellectual p ersonal and nancial

Julian Padget japmathsbathacuk

The ancestors of EULISP in alphab etical order are Common

Scho ol of Mathematical Sciences

Lisp I nterLISP LELISP LISPVM Scheme and

University of Bath

T Thus the authors of this rep ort are pleased to

Bath Avon BA AY UK

acknowledge b oth the authors of the manuals and denitions

of the ab ove languages and the many who have dissected and

extended those languages in individ ual pap ers The various

Greg Nuyens nuyensilogcom

pap ers on Standard ML and the draft rep ort on Haskell

ILOG SA

have also provided much useful input

Avenue Gallieni

Gentilly CEDEX FRANCE

The writing of this rep ort has at various stages b een sup

p orted by Bull SA Gesellschaft fur Mathematik und Daten

verarb eitung GMD Sankt Augustin Ecole Polytechniqu e

editors

LIX ILOG SA Institut National de Recherche en Infor

matique et en Automatique INRIA University of Bath

and UniversiteParis VI LITP The authors gratefully ac

knowledge this supp ort Many p eople from Europ ean Com

munitycountries have attended and contributed to EULISP

meetings since they started and the authors would liketo

thank all those who have help ed in the development of the

language

Programming Language EuLisp version

necessary But this is not the place for a detailed language

comparison That can b e drawn from the rest of this text

EULISP breaks with LISP tradition in describing all its typ es

in fact classes in terms of an ob ject system This is called

The EULISP Ob ject System or TELOS TELOS incorp orates

elements of the Common Lisp Ob ject System CLOS Ob

jVLisp MicroCeyx and MCS

Language Structure

The EULISP denition comprises the following items

Intro duction

Level comprises all the level functions macros

EULISP is a dialect of Lisp and as suchowes much to the

and sp ecial forms which is this text minus Annex B The

great b o dy of work that has b een done on language design in

ob ject system can b e extended by userdened structure

the name of Lisp over the last thirtyyears The distinguish

classes and generic functions

ing features of EULISP are i the integration of the classical

Lisp typ e system and the ob ject system into a single class

Level extends level with the functions macros

hierarchy ii the complementary abstraction facilities pro

and sp ecial forms dened in Annex B The ob ject system

vided by the class and the mo dule mechanism iii supp ort

can b e extended by userdened classes and metaclasses

for concurrent execution

The implementation of level is not necessarily written or

writable as a conforming level program

Here is a brief summary of the main features of the language

A level function is a generic function dened in this text

Classes are rstclass ob jects The class structure

to b e part of a conforming pro cessor for level A function

integrates the primitive classes describing fundamental

dened in terms of level op erations is an example of a level

datatyp es the predened classes and userdened classes

application

Mo dules together with classes are the building blo cks

Much of the functionalityofEULISP is dened in terms of

of b oth the EULISP language and of applicatio ns written

mo dules These mo dules mightbeavailable and used at

in EULISP The mo dule system exists to limit access to

anylevel but certain mo dules are required at a given level

ob jects by name That is mo dules allow for hidden de

Whenever a mo dule dep ends on the op erations available at

nitions Each mo dule denes a fresh empty lexical envi

agiven level that dep endency will b e sp ecied

ronment

EULISP level is provided by the mo dule eulisplevel

Multiple control threads can b e created in EULISP

This mo dule imp orts and reexp orts the mo dules sp ecied

and the concurrency mo del has b een designed to allow

in Table

consistency across a wide range of architectures Access

to shared data can b e controlled via lo cks semaphores

This denition is organized in three parts

Eventbased programming is supp orted through a generic

waiting function

Sections describ es the core of level of EULISP

covering mo dules simple classes ob jects and generic func Both functions and are rstclass in

ISP but the latter are not as general as in Scheme EUL

tions threads conditions control forms and events These

b ecause they can only b e used in the dynamic extentof LISP that char sections contain the information ab out EU

their creation That implies they can only b e used once

acterizes the language

A condition mechanism which is fully integrated with

Annex A describ es the additional classes required at

b oth classes and threads allows for the denition of

level and the op erations dened on instances of those

generic handlers and which supp orts b oth propagation of

classes The annex is organized by class in alphab etical

conditions and continuable handling

order These sections contain information ab out the pre

dened classes in EULISP that are necessary to make the

Dynamically scop ed bindings can b e created in

language usable but is not central to an appreciation of

EULISP but their use is restricted as in Scheme EULISP

the language

enforces a strong distinction b etween lexical bindings and

dynamic bindings by requiring the manipulation of the

Annex B describ es the reective asp ects of the ob ject

latter via sp ecial forms

system and how to program the metaob ject proto col and

some additional control forms

EULISP do es not claim any particular Lisp dialect as its

closest relative although parts of it were inuenced by fea

tures found in Common Lisp LELISP LISPVM Prior to these sections dene the scop e of the text and

Scheme and T EULISP b oth intro duces new ideas and takes error denitions and typ ographical and layout conventions

from these Lisps It also extends or simplies their ideas as used in this text

Programming Language EuLisp version

TableModules comprising eulisplevel

Conformance Denitions

Mo dule Sections

The following terms are general in that they could b e applied

character A

to the denition of any programming language They are

collection A

derived from ISOIEC TR

compare A

condition

convert A

conguration Host and target computers anyop

copy A

erating systemss and software runtime system used to

doublefloat A

op erate a language processor

elementaryfunctions A

event

fixedprecisioninteger A

conformity clause Statement that is not part of

formattedio A

the language denition but that sp ecies requirements for

function

compliance with the language standard

lock

null A

conforming program Program which is written in

number A

the language dened by the language standard and which

object

ob eys all the conformity clauses for programs in the language

pair A

standard

stream A

string A

symbol A

conforming pro cessor Processor which pro cesses

syntax

conforming programs and program units and which ob eys all

table A

the conformity clauses for processors in the language stan

dard

vector A

incorrect error Incorrect program construct or

Scop e

functioning of a program as dened by the language stan

dard

This text sp ecies the syntax and semantics of the computer

programming language EULISP by dening the requirements

for a conforming EULISP pro cessor and a conforming EULISP

extension Facilityintheprocessor that is not sp ec

program the textual representation of data and algorithms

ied in the language standard but that do es not cause any

ambiguityorcontradiction when added to the language stan

This text do es not sp ecify

dard

a The size or complexityofaEULISP program that will

exceed the capacityofany sp ecic conguration or pro

implementationdened Sp ecic to the proces

cessor nor the actions to b e taken when those limits are

sor but required by the language standard to b e dened

exceeded

and do cumented by the implementer

b The minimal requirements of a conguration that is

capable of supp orting an implementation of a EULISP pro

pro cessor translator or work

cessor

ingincombination with a conguration

c The metho d of preparation of a EULISP program for

execution or the metho d of activation of this EULISP pro

Error Denitions

gram once prepared

Errors in the language describ ed in this denition fall into

d The metho d of rep orting errors warnings or excep

one of the following three classes

tions to the clientofaEULISP pro cessor

e The typ ographical representation of a EULISP pro

dynamic error An error which is detected during

gram for human reading

the execution of a EULISP program or which is a violation of

the dened dynamic b ehaviour of EULISP Dynamic errors

f The means to map mo dule names to the ling system

havetwo classications

or other ob ject storage system attached to the pro cessor

a Where a conforming processor is required to detect

To clarify certain instances of the use of English in this text

the erroneous situation or b ehaviour and rep ort it This is

the following denitions are provided

signied by the phrase an error is signal led The condition

class to b e signalled is sp ecied Signallin g an error con

must averbal form used to intro duce a required prop

sists of identifying the condition class related to the error

erty All conforming pro cessors must satisfy the prop erty

and allo cating an instance of it This instance is initial

ized with information dep endent on the condition class A should Averbal form used to intro duce a strongly rec

conforming EULISP program can rely on the fact that this ommended prop erty Implementors of pro cessors are urged

condition will b e signalled but not required to satisfy the prop erty

Programming Language EuLisp version

mented by this processor due to nonsupp ort of a partic b Where a conforming processor mightormight not de

ular facility where such nonsupp ort is p ermitted by the tect and rep ort up on the error This is signied by the

standard phrase is an error A pro cessor should provide a mo de

where such errors are detected and rep orted where p ossi

ble

c A list of all the features of the language implemented

bythis processor whichareextensions to the standard

language

environmental error An error which is detected

by the conguration supp orting the EULISP pro cessor The

d A statement of conformity giving the complete ref

pro cessor must signal the corresp onding dynamic error which

erence of the language standard with which conformity

is identied and handled as describ ed ab ove

is claimed and if appropriate the level of the language

supp orted by this pro cessor

static error An error which is detected during the

preparation of a EULISP program for execution suchasa

violation of the syntax or static semantics of EULISP by the

Conventions

program under preparation

This section denes the conventions employed in this text

NOTE The violation of the syntactic or static semantic re

how denitions will b e laid out the typ eface to b e used the

quirements is not an error but an error might b e signalled by the

metalanguage used in descriptions and the naming conven program p erforming the analysis of the EULISP program

tions A later section contains denitions of the terms

used in this text All errors sp ecied in this denition are dynamic unless ex

plicitly stated otherwise

Layout and Typ ography

Compliance

Both la yout and fonts are used to help in the description of

EULISP A language element is dened as an entry with its

An EULISP pro cessor can conform at either of the two levels

name as the heading of a clause coupled with its classi

dened under Language Structure in the Intro duction Thus

cation Examples of several kinds of entry are now given

alevel conforming pro cessor must supp ort all the basic

Some subsections of entries are optional and are only given

expressions classes and class op erations dened at level

where it is felt necessary

A level conforming pro cessor must supp ort all the basic

expressions classes class op erations and mo dules dened at

level and at level

aspecialform special form

The following two statements govern the conformance of a

pro cessor at a given level

Syntax

a A conforming processor must correctly pro cess all pro

aspecialform form form

n

grams conforming b oth to the standard at the sp ecied

level and the implementationdened features of the pro

cessor

Arguments

b A conforming processor should oer a facility to re

p ort the use of an extension which is statically deter

form description of structure and role of form

minable solely from insp ection of a program without ex

ecution It is also considered desirable that a facilityto

rep ort the use of an extension which is only determinable

form description of structure and role of form

dynamically b e oered n n

A level conforming program is one which observes the syn

tax and semantics dened for level A level conforming

Result

program might not conform at level A strictlyconforming

A description of the result

level program is one that also conforms at level A level

conforming program observes the syntax and semantics

dened for level

Remarks

In addition a conforming program at any level must not use

Any additional information dening the b ehaviour of

any extensions implemented by a language processor but it

aspecialform

can rely on implementationdened features

The do cumentation of a conforming processor must include

Examples

Some examples of use of the sp ecial form and the b ehaviour

a A list of all the implementationdened denitions or

that should result

values

b A list of all the features of the language standard

which are dep endent on the processor and not imple See also Cross references to related entries

Programming Language EuLisp version

Sp ecialized Arguments

afunction function

argumenta classa means that argumenta of the

metho d must b e an instance of classa Of course this

argumentmust b e one whichwas dened in ageneric

Arguments

as b eing op en to sp ecializa tion and classa mustbea

sub class of the class

argumenta information ab out the class or classes of

argumenta

argumentn means that i argumentn is an instance of

object ie it is unconstrained ii ageneric do es not

argumentn information ab out the class or classes of

sp ecialize on argumentn iii no metho d on ageneric

the optional argument argumentn

can sp ecialize on argumentn

Result

Result

A description of the result and p ossibly its class

A description of the result and p ossibly its class

Remarks

Remarks

Any additional information ab out the actions of afunction

Any additional information ab out the actions of this metho d

attached to ageneric

Examples

Some examples of calling the function with certain argu

See also Cross references to related entries

ments and the result that should b e returned

acondition aconditionsuperclass

See also Cross references to related entries

Initializatio n Options

ageneric generic function

initarga valuea means that an instance of

acondition has a slot called initarga which should

Generic Arguments

b e initiali zed to valueawhere valuea is often the name

of a class indicating that valuea should b e an instance of

argumenta classa means that argumenta of

that class and a description of the information that value

ageneric must b e an instance of classa and that

a is supp osed to provide ab out the exceptional situation

argumenta is one of the arguments on which ageneric

that has arisen

sp ecializes Furthermore each metho d dened on

ageneric may sp ecialize only on a sub class of classa

for argumenta

initargn valuen As for initarga

Remarks argumentn means that i argumentn is an instance of

object ie it is unconstrained ii ageneric do es not

Any additional information ab out the circumstances in

sp ecialize on argumentn iii no metho d on ageneric

which the condition will b e signalled

can sp ecialize on argumentn

classname class

Result

A description of the result and p ossibly its class

Initializatio n Options

Remarks

initarga valuea means that classname has an

initarg whose name is initarga and the description will

Any additional information ab out the actions of ageneric

usually say of what class or classes valuea should b e an

This will probably b e in general terms since the actual b e

instance This initarg is required

haviour will b e determined by the metho ds

See also Cross references to related entries

initargn valuen The enclosing square brackets de

note that this initarg is optional Otherwise the interpre

tation of the denition is as for initarga

ageneric method

Remarks

A metho d on ageneric with the following sp ecialized ar

guments A description of the role of classname

Programming Language EuLisp version

MetaLanguage all condition classes The exception is class itself whichis

the default metaclass The prex should describ e the general

domain of the classes in question but not necessarily any

The terms used in the following descriptions are dened in

particular class in the set

Annex

A standard function denotes an immutable toplexical bind

ing of the dened name All the denitions in this text are

generic prex The generic version of the

bindings in some mo dule except for the sp ecial form op era

function named by the stem

tors whichhave no denition anywhere All bindings and

all the sp ecial form op erators can b e renamed

hyphenation Function and class names made up

NOTE A description making mention of an x where x is

of more than one word are hyphenated for example

the name a class usually means an instance of x

computespecializedslotdescriptionclass

Frequently a classdescriptive name will b e used in the ar

gument list of a function description to indicate a restric

tion on the domain to which that argument b elongs In the

p sux A predicate function is named byap

case of a function it is an error to call it with a value out

sux if the function or class name after removing the enclos

side the sp ecied domain A generic function can b e dened

ing and is not hyphenated for instance conspandis

with a particular domain andor range In this case any

named byap sux if it is for instance doublefloatp

new metho ds must resp ect the domain andor range of the

generic function to which they are to b e attached The use of

a classdescriptive name in the context of a generic function

denition denes the intention of the denition and is not

Denitions

necessarily a p oliced restriction

This set of denitions which are b e used throughout this

If it is required to indicate rep etition the notation

denition is selfconsistentbutmight not agree with notions



expression and expression will b e used for zero or more

accepted in other language denitions The terms are dened

and one or more o ccurrences resp ectively The arguments in

in alphab etical rather than dep endency order and where a

some function descriptions are enclosed in square brackets

denition uses a term dened elsewhere in this section it

graphic representation and This indicates that the

is written in italics Some of the terms dened here are

argument is optional The accompanying text will explain

redundant Names in courier font refer to entities dened

what default values are used

in the language

The resultclass of an op eration except in one case refers to

a primitive or a dened class describ ed in this denition The

boolean A b o olean value is either false whichis

exception is for predicates Predicates are dened to return

represented by the empty listwritten and is also the

either the empty listwritten representing the b o olean

or truewhichisrepresented byany other value value of nil

value false or anyvalue other than representing true

than

Although the class containing exactly this set of values is not

dened in the language notation is abused for convenience

and boolean is dened for the purp oses of this rep ort to

class A class is an object which describ es the struc

mean that set of values If the true value is a useful value

ture and b ehaviour of a set of objects which are its instances

it is sp ecied precisely in the description of the function

A class ob ject contains inheritance information and a set of

slot descriptions which dene the structure of its instances

A class object is an instance of a metaclass All classes

Naming

in EULISP are subclasses of object and all instances of

class are classes

Naming conventions are applied in the descriptions of prim

itive and dened classes as well as in the choice of other

function names Here is a list of the conventions and some

dening form Any form or any macro expres

examples of their use

sion expanding into a form whose op erator is one

of defclass defcondition defconstant defgeneric

deflocal defmacro defstruct defunor defvar

name wrapping By convention classes have

names which b egin with and end with

direct instance A direct instance of a class class

is any object whose most sp ecic class is class

binary prex The two argumentversion of a

nary argument function There is not always a corresp on

dence b etween the ro ot and the name of the nary function

direct sub class A class is a direct subclass of

for example binaryplus is the two argument generic func

class if class is a subclass of class class is not identical

 

tion corresp onding to the nary argument function

to class and there is no other class whichisasuperclass

 

of class and a subclass of class



class sux The name of a metaclass of a set

of related classes For example functionclass whichis

the class of simplefunction genericfunction and direct sup erclass A direct superclass of a class

any of their sub classes and conditionclass is the class of class is any class for which class is a direct subclass

Programming Language EuLisp version

inner lexical Inner lexical bindings are created by dynamic environment The inner and top dy

lambda and letcc referenced by variables and mo died by namic environment taken together are referred to as the

setq Inner lexical bindings extendand can shadowthe dynamic environment

lexically enclosing lexical environment Note that letcc

creates an immutable binding

function A function is either a continuationa sim

ple function or a generic function

instance Every object is the instance of some

class An instance thus describ es an object in relation to

its class An instance takes on the structure and b ehaviour

generic function Generic functions are functions

describ ed by its class An instance can b e either direct or

for which the method executed dep ends on the class of its

indirect

arguments A generic function is dened in terms of methods

which describ e the action of the generic function for a sp ecic

set of argument classes called the metho ds domain

instantiation graph A directed graph whose

no des are objects and whose edges are dened bythein

stance relations b etween the objects This graph has only

indirect instance An indirect instance of a class

one cycle an edge from class to itself The instantation

class is any object whose class is an indirect subclass of

graph is a tree and class is the ro ot

class

lexical environment The inner and top lexical

indirect sub class A class is an indirect sub class

environment of a mo dule are together referred to as the lex

of class if class is a subclass of class class is not identical

 

ical environment except when it is necessary to distinguish

to class and there is at least one other class whichisa

 

between them

erclass of class and a subclass of class sup



metaclass A metaclass is a class object whose in

inheritance graph A directed lab elled acyclic

stances are themselves classes All metaclasses in EULISP

graph whose no des are classes and whose edges are dened by

are instanc es of class whichisaninstance of itself All

the direct subclass relations b etween the no des This graph

metaclasses are also subclasses of class class is a

has a distinguish ed ro ot the class object whichisasu

metaclass

perclass of every class

metho d A metho d describ es the action of a

inherited slot description A slot description is

generic function for a particular list of argument classes

inherited for a class if the slot description is dened for an

called the metho ds domainAmethod is thus said to add to

other class which is a direct or indirect superclass of class



the b ehaviour of eachoftheclasses in its domain Metho ds

are not functions but objects whichcontain among other in

formation a function representing the metho ds b ehaviour

initarg A symbol used as a keywordinaninitlist to

mark the value of some slot or additional information Used

metho d sp ecicity A domain domain is more

in conjunction with make and the other object initializa tion

sp ecic than another domain if the rst class in domain

functions to initiali ze the ob ject An initarg may b e declared



is a subclass of the rst class in domain or if they are the

for a slot in a class denition form using the initarg slot



same the rest of domain is more sp ecic than the rest of

option or the initargs class option

domain



initform A form whichisevaluated to pro duce a

multimetho d A method which sp ecializes on

default initial slot value Initforms are closed in their lexi

more than one argument

cal environments and the resulting closure is called an init

function An initform may b e declared for a slot in a class

denition form using the initform slot option

new instance A newly allo cated instance which

is distinct but can b e isomorphic to other instances

initfunction A function of no arguments whose

result is used as the default value of a slot Initfunctions

reective A system which can examine and mo d

capture the lexical environmentofaninitform declaration in

ify its own state is said to b e reective EULISP is reectiveto

a class denition form

the extent that it has explicit class ob jects and metaclasses

and userextensible op erations up on them

initlist A list of alternating keywords and values

which describ es some notyet instantiated ob ject Generally

selfinstantiated class A class whichisanin

the keywords corresp ond to the initargs of some class

stance of itself In EULISP class is the only example

of a selfinstantiated class

inner dynamic Inner dynamic bindings are cre

ated by dynamiclet referenced by dynamic and mo died setter function The function asso ciated with the

by dynamicsetq Inner dynamic bindings extendand can function that accesses a place in an entitywhichchanges the

shadowthe dynamicall y enclosing dynamic environment value stored in that place

Programming Language EuLisp version

defclass defcondition defconstant defgeneric simple function A function comprises at least

defmacro defstruct defun an expression a set of identiers which o ccur in the expres

sion called the parameters and the closure of the expression

All these bindings are immutable deflocal creates a muta with resp ect to the lexical environment in which it o ccurs

ble toplexical binding All such bindings are referenced by less the parameter identiers Note this is not a denition

variables and those made by deflocal are mo died by setq of the class simplefunction

Each mo dule denes its own distinct top lexical environment

slot A named comp onentofanobject which can

b e accessed using the slots accessor Each slot of an object

is describ ed bya slot description asso ciated with the class of

the object When we refer to the structure of an objectthis

usually means its set of slots

slot description A slot description describ es a

slot in the instances of a class This description includes the

slots name its logical p osition in instancesanda waytode

termine its default value A classs slot descriptions maybe

accessed through the function classslotdescriptionsA

slot description can b e either direct or inherited

slot option Akeyword and its asso ciated value

applying to one of the slots app earing in a class denition

form for example the accessor keyword and its value

which denes a function used to read or write the value of a

particular slot

slot sp ecication A list of alternating keywords

and values starting with a keyword which represents a not

yetcreated slot description during class initiali zati on

sp ecial form A sp ecial form is a semantic prim

itive of the language In consequence any pro cessor for

example a compiler or a co dewalker need b e able to pro

cess only the sp ecial forms of the language and comp ositions

of them

sp ecialize Averbal form used to describ e the cre

ation of a more sp ecic version of some entity Normally

applied to classes slotdescriptions and metho ds

sp ecialize on Averbal form used to describ e re

lationship of metho ds and the classes sp ecied in their do

mains

sub class The b ehaviour and structure dened by

a class class are inherited byasetofclasses which are

termed subclasses of class Asubclass can b e either direct

or indirect or itself

sup erclass A class is a sup erclass of class i



class is a sub class of class A superclass can b e either



direct or indirect or itself

top dynamic Top dynamic bindings are cre

ated by defvar referenced by dynamic and mo died by

dynamicsetq There is only one top dynamic environment

top lexical Top lexical bindings are created in the

top lexical environment of a mo dule by

Programming Language EuLisp version

Ob jects Syntax

The syntax of the classes of ob jects that can b e read by

Case is distinguish ed in eachofcharacters strings and iden

EULISP is dened in the section of this denition corresp ond

tiers so that variablename and Variablename are dif

ing to the class as dened in Table The syntax for identi

ferent but where a character is used in a p ositional num

ers corresp onds to that for symb ols

b er representation eg xAd the case is ignored Thus

case is also signicant in this denition and as will b e

Table Syntax of ob jects for reading and writing

observed later all the sp ecial form and standard function

names are lower case In this section and throughout this

text the names for individua l character glyphs are those

used in ISOIEC DIS

object

character A

The minimal character set to supp ort EULISP is dened in

float A

integer A

Table The language as dened in this text uses only the

list A

characters given in this table Thus left hand sides of the

string A

pro ductions in this table dene and name groups of char

symbol A

acters which are used later in this denition decimal digit

vector A

upper letter lower letter letter other character and special

character

Table Minimal character set

decimal digit

upper letter

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

lower letter

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

letter

upper letter lower letter

other character

special character

level character

decimal digit letter other character

special character

Whitespace and Comments

Whitespace characters are space and newline The newline

character is also used to represent end of record for congu

rations providing such an input mo del thus a reference to

newline in this denition should also b e read as a reference

to end of record The only use of whitespace is to improve

the legibil ity of programs for human readers Whitespace

separates tokens and is only signicant in a string or when

it o ccurs escap ed within an identier

A commentisintro duced bythecommentbegin glyph called

semicolon and continues up to but do es not include

the end of the line Hence a comment cannot o ccur in the

middle of a token b ecause of the whitespace in the form of

the newline Thus a comment is equivalent to whitespace

NOTE There is no notation in EULISP for blo ck comments

Programming Language EuLisp version

Mo dules forms where the keywords indicate the interpretation of the

forms This representation allows for the addition of fur

ther keywords at other levels of the denition and also for

The EULISP mo dule scheme has several inuences LeLisps

implementationde ned keywords For the keywords given

mo dule system and mo dule compiler complice Haskell ML

here there is no dened order of app earance nor is there

MITSchemes makeenvironment and Ts lo cales

any restriction on the numb er of times that a keyword can

app ear Multiple o ccurrences of any of the directives dened

All bindings of ob jects in EULISP reside in some mo dule

here are treated as if there is a single directive whose form is

somewhere Also all programs in EULISP are written as one

the combination of each of the o ccurrences This denition

or more mo dules Almost every mo dule imp orts a number

describ es the pro cessing of four keywords which are now de

of other mo dules to make its denition meaningful These

scrib ed in detail The syntax of all the directives is given in

imp orts havetwo purp oses which are separated in EULISP

Table and an example of their use app ears in Figure

rstly the bindings needed to pro cess the syntax in which

the mo dule is written and secondly the bindings needed to

resolve the free variables in the mo dule after syntax expan

Exp ort Directive

sion These bindings are made accessible by sp ecifying which

mo dules are to b e imp orted for which purp ose in a directive

This is denoted bythekeyword export followed by a list of

at the b eginning of each mo dule The names of mo dules

names of toplexical bindings dened in this mo dule and has

are b ound in a disjoint binding environment which is only

the eect of making those bindings accessible to anymod

accessible via the mo dule denition form That is to say

ule imp orting this mo dule by adding them to the external

mo dules are not rstclass The b o dy of a mo dule deni

environment of the mo dule A name clash can arise in the

tion comprises a list of directives followed by a sequence of

external environmentfrominteraction with exp osed mo d

denitions expressions and exp ort forms

ules

The mo dule mechanism provides abstraction and securityin

a form complementary to that provided by the ob ject system

Imp ort Directive

Indeed although ob jects do supp ort data abstraction they

do not supp ort all forms of information hiding and they are

The purp ose of this directive is to sp ecify the imp orted bind

usually conceptually smaller units than mo dules A mo dule

denes a mapping b etween a set of names and either lo cal ings which constitute part of the toplexical environmentof

a mo dule These are the explicit runtime dep endencies of

or imp orted bindings of those names Most such bindings

are immutable The exception are those bindings created by the mo dule Additional runtime dep endencies may arise as

a result of syntax expansion These are called implici t run

deflocal whichmay b e mo died by b oth the dening and

imp orting mo dules There are no implicit imp orts into a time dep endencies

mo dulenot even the sp ecial forms are available in a mo d

ule that imp orts nothing A mo dule exp orts nothing by de The imp ort directive is a sequence of moduledescriptors b e

and rename ing mo dule names or the lters except only

fault Mutually referential mo dules are not p ossible b ecause

a mo dule must b e dened b efore it can b e used Hence the which denotes the union of all the names generated by each

element of the sequence A lter can in turn b e applied to a

imp ortation dep endencies form a directed acyclic graph

sequence of mo dule descriptors and so the eect of dierent

NOTE The issue of mutually referential mo dules will b e ad

kinds of lters can b e combined by nesting them An im

dressed in a future version of the denition of EULISP

p ort directive sp ecies either the imp ortation of a mo dule in

its entirety or the selective imp ortation of sp ecied bindings

The pro cessing of a mo dule denition uses three environ

from a mo dule

ments which are initiall y empty These are the toplexical

the external and the syntax environments of the mo dule

In pro cessing imp ort directives every name should b e

The toplexical environment comprises all the lo cally dened

thought of as a pair of a modulename and a localname

bindings and all the imp orted bindings The external envi

Intuitively a namelist of such pairs is generated by reference

ronment comprises all the exp osed bindings bi nd in gs from

to the mo dule name and then ltered by except only and

mo dules b eing exp osed by this mo dule but not necessarily

rename In an imp ort directive when a namelist has b een

imp ortedand all the exp orted bindings which are either

ltered the names are regarded as b eing dened in the top

lo cal or imp orted Thus the external environment might

lexical environment of the mo dule into which they have b een

not b e a subset of the toplexical environment b ecause by

imp orted A name clash can arise in the toplexical environ

virtue of an exp ose directive it can contain bindings from

ment from interaction b etween dierent imp orted mo dules

mo dules whichhave not b een imp orted This is the environ

Elements of an imp ort directiveareinterpreted as follows

ment received byany mo dule imp orting this mo dule The

syntax environment comprises all the bindings available for

except Filters the names from each moduledescriptor

the syntax expansion of the mo dule Each binding is repre

discarding those sp ecied and keeping all other names

sented as a pair of a lo calname and a mo dulename It is

The except directive is convenient when almost all of the

a static error if anytwo instances of lo calname in any one

names exp orted by a mo dule are required since it is only

of these environments have dierent mo dulenames This is

necessary to name those few that are not wanted to ex

called a name clash These environments do not all need to

clude them

exist at the same time but it is simpler for the purp oses of

denition to describ e mo dule pro cessing as if they do

modulename All the exp orted names from module

name

Directives

Filters the names from each moduledescriptor only

keeping only those names sp ecied and discarding all other

names The only directiveisconvenient when only a few The list of mo dule directives is a sequence of keywords and

Programming Language EuLisp version

defmodule amodule

import

module import everything from module

except bindinga module al l but bindinga from module

only bindingb module only bindingb from module

rename

bindingc bindingd bindingd bindingc al l of module but exchange

module the names of bindingc and bindingd

syntax

syntaxmodule al l of the module syntaxmodule

rename syntaxa syntaxb rename the binding of syntaxa

syntaxmodule of syntaxmodule as syntaxb

rename syntaxc syntaxa rename the binding of syntaxc

syntaxmodule of syntaxmodule as syntaxa

expose

except bindinge module al l but bindinge from module

module export al l of module

export

binding binding binding and three bindings from this module

export localbinding a fourth binding from this module

export bindingc the imported binding bindingc

Figure Example of mo dule directives

defmodule eulisplevel

It is also meaningful for a mo dule to include itself in an

expose

exp ose directive In this way it is p ossible to refer to all the

character collection compare condition convert copy

bindings in the mo dule b eing dened This is convenient

doublefloat elementaryfunctions event

in combination with except see Section as a wayof

formattedio fixedprecisioninteger function list

exp orting all but a few bindings in a mo dule esp ecially if

lock number object stream string symbol syntax

syntax expansion creates additional bindings whose names

table thread vector

are not known but should b e exp orted

Figure Example mo dule using expose

Syntax Directive

This directive is pro cessed in the same way as an imp ort

names exp orted by a mo dule are required since it is only

directive except that the bindings are added to the syntax

necessary to name those that are wanted to include them

environment This environment is used in the second phase

of mo dule pro cessing syntax expansion These constitute

rename Filters the names from each moduledescriptor

the dep endencies for the syntax expansion of the denitions

replacing those with oldname by newnameAnyname

and expressions in the b o dy of the mo dule A name clash

not mentioned in the replacement list is passed unchanged

can arise in the syntax environment from interaction b etween

Note that once a name has b een replaced the newname

dierentsyntax mo dules

is not compared against the replacement list again Thus

a binding can only b e renamed once by a single rename

It is imp ortant to note that sp ecial forms are considered part

directive In consequence name exchanges are p ossible

of the syntax and they may also b e renamed

Exp ose Directive

Denitions and Expressions

Denitions in a mo dule only contain unqualied names This is denoted by the keyword expose followed by a list of

that is localnames using the ab ove terminology A top moduledirective s The purp ose of this directive is to allow

lexical binding is created exactly once and shared with all a mo dule to exp ort subsets of the external environments of

mo dules that imp ort its exp orted name from the mo dule that various mo dules without imp orting them itself Pro cessing

created the binding A name clash can arise in the toplexical an exp ose directive employs the same mo del as for imp orts

vironment from interaction b etween lo cal denitions and en namely a pair of a mo dulename and a lo calname with the

between lo cal denitions and imp orted mo dules Only top same ltering op erations When the namelist has b een l

lexical bindings created by deflocal are mutableb oth in tered the names are added to the external environmentof

the dening mo dule and in any imp orting mo dule It is a the mo dule b egin pro cessed A name clash can arise in the

static error to mo dify an immutable binding Expressions external environment from interaction with exp orts or b e

that is nondening forms are collected and evaluated in or tween dierent exp osed mo dules As an example of the use

der of app earance at the end of the mo dule denition pro cess of expose a p ossible implementation of the eulisplevel

when the toplexical environment is completethat is after mo dule is shown in Figure

Programming Language EuLisp version

Table Mo dule syntax

nedstepsmaybe NOTE Additional implementationde

added here such as compilation

initialization The toplexical bindings of the mo dule

module

created ab ove are initiali zed byevaluating the forms in

defmodule module name

the b o dy of the mo dule in the order they app ear

module directives module form

module name

NOTE In this sense a mo dule can b e regarded as a gener

identifier A

alization of the labels form of this and other Lisp dialects

module directives

module directive

module directive

export identifier

Mo dule Denition

expose module descriptor

import module descriptor

defmodule syntax

syntax module descriptor

level module form

export identifier

Syntax

level expression

defining form

The syntax of a mo dule and its constituents is dened in

progn module form

Table

module descriptor

module name

module filter

Arguments

module filter

except identifier

modulename Asymb ol used to name the mo dule

module descriptor

only identifier

moduledirective A form sp ecifying the exp orted names

module descriptor

exp osed mo dules imp orted mo dules and syntax mo dules

rename rename pair

module descriptor

used by this mo dule

rename pair

identifier identifier

moduleform A sequence of dening forms expressions

and exp ort forms

Remarks

the creation and initial iza tion of the toplexical bindings

The defmodule form denes a mo dule named by module

The exception to this is the progn form which is descended

name and asso ciates the name modulename with a mo dule

and the forms within it are treated as if the progn were

ob ject in the mo dule binding environment

not present Denitions may only app ear either at toplevel

within a mo dule denition or inside anynumber of progn

NOTE Intentionally nothing is dened ab out any relationship

forms This is sp ecied more precisely in the grammar for a

between mo dules and les

mo dule given in Table

Examples

Mo dule Pro cessing

An example mo dule denition with explanatory comments

is given in Figure

The following steps summarize the mo dule denition pro

cess

directive pro cessing This is describ ed in detail in

Section This step creates and initiali zes the top

lexical syntax and external environments

syntax expansion The b o dy of the mo dule is ex

panded according to the op erators dened in the syntax

environment constructed from the syntax directive

NOTE The semantics of syntax expansion are still under

discussion and will b e describ ed fully in a future version of

the EULISP denition In outline however it is intended that

the mechanism should provide for hygenic expansion of forms

in sucha way that the programmer need have no knowledge

of the expansiontime or runtime dep endencies of the syntax

dening mo dule

static analysis The expanded b o dy of the mo dule

is analyzed Names referenced in exp ort forms are added

to the external environment Names dened by dening

forms are added to the toplexical environment It is a

static error if a free identier in an expression or dening

form do es not have a binding in the toplexical environ

ment

Programming Language EuLisp version

object

Ob jects

character

condition

function

In EULISPevery ob ject in the system has a sp ecic class

continuation

Classes themselves are rstclass ob jects In this resp ect

simplefunction

EULISP diers from staticallytyp e d ob jectoriented lan

genericfunction

guages suchasC and CEYXThe EULISP ob ject sys

list

tem is called TELOS The facilities of the ob ject system are

cons

split across the two levels of the denition Level sup

null

p orts the denition of generic functions metho ds and struc

lock

tures Level provides the reective system which supp orts

number

the metaob ject proto col MOP introsp ection the de

integer

fixedprecisioninteger

nition of new metaclasses and the sp ecializati on of classes

float

other than structures Metaclasses control the structure

doublefloat

and b ehaviour of their instances and the representation of

stream

their metainstances Extensions at level suchasmulti

string

ple inheritance supp ort for the changeclass functionali ty

structure

of CLOS and p ersistent ob jects can b e supp orted through

symbol

metaclasses In addition metaclasses can provide new kinds

table

of classes with reduced p ower but increased eciency the

thread

class structureclass is an example No metaclass nor

vector

any op eration which could return a metaclass as a result

Figure Level initial class hierarchy

eg classof are accessible at level That supp orts the

clear distinction b etween ob ject level and metaob ject level

programming required for many optimizations

ELOS typically involve the design Programs written using T

Generic functions are dened using the defgeneric dening

of a class hierarchy where each class represents a category of

form which creates a named generic function in the top

entities in the problem domain and a protocol which denes

lexical environment of the mo dule in which it app ears and

the op erations on the ob jects in the problem domain

genericlambdawhich creates an anonymous generic func

tion These forms are describ ed in detail later in this section

A class denes the structure and b ehaviour of its instances

Structure is the information contained in the classs instances

Metho ds can either b e dened at the same time as the generic

and behaviour is the way in which the instances are treated

function or else dened separately using the defmethod

by the proto col dened for them

macro which adds a new metho d to an existing generic func

tion This macro is describ ed in detail later in this section

The comp onents of an ob ject are called its slots Each slot

of an ob ject is dened by its class

System Dened Classes

A proto col denes the op erations which can b e applied to in

stances of a set of classes This proto col is typically dened

in terms of a set of generic functionswhich are functions

The basic classes of EULISP are elements of the ob ject sys

whose applicatio n b ehaviour dep ends on the classes of the

tem class hierarchywhichisshown in Figure Indentation

arguments The particular classsp ecic b ehaviour is parti

indicates a sub class relationship to the class under whichthe

tioned into separate units called methods A metho d is not

line has b een indented for example condition is a sub

a function itself but is a closed expression which is a com

class of object The names given here corresp ond to the

p onent of a generic function

bindings of names to classes as they are exp orted from the

level mo dules Classes directly relevant to the ob ject sys

Generic functions replace the send construct found in many

tem are describ ed in this section while others are describ ed

ob jectoriented languages In contrast to sending a message

in corresp onding sections eg condition is describ ed in

to a particular ob ject whichitmust knowhow to handle

the conditions section

the metho d executed by a generic function is determined by

all of its arguments Metho ds which sp ecialize on more than

In this denition unless otherwise sp ecied classes declared

one of their arguments are called multimethods

to b e sub classes of other classes may b e indirect sub classes

Classes not declared to b e in a sub class relationship are dis

Inheritance is provided through classes Slots and metho ds

joint Furthermore unless otherwise sp ecied all ob jects

dened for a class will also b e dened for its sub classes but

declared to b e of a certain class may b e indirect instances of

a sub class may sp ecialize them In practice this means that

that class

an instance of a class will contain all the slots dened di

rectly in the class as well as all of those dened in the classs

sup erclasses In addition a metho d sp ecialized on a particu

lar class will b e applicable to direct and indirect instances of

object class

this class The inheritance rules the applicabil i ty of meth

o ds and the generic dispatch are describ ed in detail later in

this section The ro ot of the inheritance hierarchy object denes

the basic metho ds for initial izati on and external represen

Classes are dened using the defstruct and tation of ob jects No initializa tion options are sp ecied for

defcondition dening forms object

Programming Language EuLisp version

Table defstruct syntax

structure class

defstruct form

The default sup erclass of structure classes All classes de

defstruct class name superclass name

slot description list class option

ned using the defstruct form are direct or indirect sub

class name

classes of structureThus this class is sp ecializabl e by

identifier A

user dened classes at level No initoptions are sp ecied

superclass name

for structure

identifier A

slot description list

slot decsription

slot description

teloscondition condition

slot name

slot name slot option

slot name

This is the general condition class for conditions arising from

identifier A

op erations in the ob ject system

slot option

initarg identifier A

initform level expression

Single Inheritance

reader identifier A

writer identifier A

accessor identifier A

TELOS level provides only single inheritance meaning that

class option

a class can have exactly one direct sup erclassbut indef

initargs identifier

initely many direct sub classes In fact all classes in the

constructor identifier

level class inheritance tree have exactly one direct sup er

initarg name

class except the ro ot class object which has no direct

predicate identifier A

sup erclass

Each class has a class precedence list CPL a linearized list

of all its sup erclasses which denes the classes from which

slotspec A list of slot sp ecications see b elow

the class inherits structure and b ehaviour For single inher

itance classes this list is dened recursively as follows comprising either a slotname or a list of a slotname fol

lowed by some slotoptions

a the CPL of object is a list of one element containing

classoption A sequence of keys and values see b elow

object itself

which taken together apply to the class as a whole

b the CPL of any other class is a list of classes b eginning

with the class itself followed by the elements of the CPL

Remarks

of its direct sup erclass whichisobject by default

defstruct creates a new structure class Structure classes

supp ort single inheritance as describ ed ab ove Neither class

The class precedence list controls systemdened proto cols

redenition nor changing the class of an instance is supp orted

concerning



by structure classes

a inheritance of slot and class options when initializi ng

The slotoption s are interpreted as follows

a class

initarg identier The value of this option is an identi

b metho d lo okup and generic dispatch when applying a

er naming a symb ol which is the name of an argumentto

generic function

b e supplied in the initoption s of a call to make on the new

class The value of this argument in the call to make is the

initial value of the slot This option must only b e sp eci

Dening Classes

ed once for a particular slot The same initarg name may

b e used for several slots in which case they will share the

defstruct dening form

same initial value if the initarg is given to make Sub classes

inherit the initarg Eachslotmust haveatmostoneini

targ includin g the inherited one That means a sub class

Syntax

can not shadow or add a new initarg if a sup erclass has

already dened one

The syntax for defstruct is given in Table

initform form The value of this option is a form which

is evaluated as the default value of the slot to b e used if

Arguments

make no initarg is dened for the slot or given to a call to

The form is evaluated in the lexical environment of the call

classname A symb ol naming a binding to b e initiali zed

to defstruct and the dynamic environment of the call to

with the new structure class The binding is immutable



In combination with the guarantee that the b ehaviour of

superclassname A symb ol naming a binding of a class

generic functions cannot b e mo died once it has b een dened

to b e used as the direct sup erclass of the new structure

due to no supp ort for metho d removal nor metho d combination

this imbues level programs with static semantics class

Programming Language EuLisp version

make The form is evaluated eachtimemake is called and Dening Generic Functions and Metho ds

the default value is called for The order of evaluation of

the initforms in all the slots is determined by initialize

defgeneric dening form

This option must only b e sp ecied once for a particular

slot Sub classes inherit the initform However a more

sp ecic form may b e sp ecied in a sub class which will

Syntax

shadow the inherited one

reader identier The value is the identier of the vari

defgeneric form

able to which the reader function will b e b ound The

defgeneric gf name gf lambda list

binding is immutable The reader function is a means to

level init option

access the slot The reader function is a function of one

gf name

argument which should b e an instance of the new class

identifier A

gf lambda list No writer function is automatically b ound with this op

specialized lambda list

tion This option can b e sp ecied more than once for a

level init option

slot creating several bindings for the same reader func

method method description

tion It is a static error to sp ecify the same reader writer

method description

or accessor name for two dierent slots

specialized lambda list form

specialized lambda list

specialized parameter

writer identier The value is the identier of the vari

specialized parameter

able to which the writer function will b e b ound The bind

identifier A

ing is immutable The writer function is a means to change

specialized parameter

the slot value The creation of the writer is analogous to

identifier class name A

that of the reader function The writer function is a func

identifier A

tion of two arguments the rst should b e an instance of

the new class and the second can b e anynewvalue for the

slot This option can b e sp ecied more than once for a

slot It is a static error to sp ecify the same reader writer

Arguments

or accessor name for two dierent slots

gfname One of a symb ol or a form denoting a setter

accessor identier The value is the identier of the

function or a converter function

variable to which the reader function will b e b ound In ad

dition the use of this slotoption causes the writer function

genlambdalist The parameter list of the generic func

to b e asso ciated to the reader via the setter mechanism

tion whichmay b e sp ecialized to restrict the domain of

This option can b e sp ecied more than once for a slot

metho ds to b e attached to the generic function

It is a static error to sp ecify the same reader writer or

accessor name for two dierent slots

levelinitoption Options as sp ecied b elow

The class options are interpreted as follows

Remarks

This dening form denes a new generic function The re

initargs list The value of this option is a list of iden

sulting generic function will b e b ound to gfname The sec

tiers naming symb ols which extend the inherited names

ond argument is the formal parameter list The metho ds

of arguments to b e supplied in the initoption sofacall

sp ecialized lamba list must b e congruenttothatofthe

to make on the new class Initargs are inherited by union

generic function Twolamb da lists are said to b e congru

The values of all legal arguments in the call to make are

ent i

the initial values of corresp onding slots if they name a slot

initarg or are ignored by the default initialize metho d

a b oth have the same numb er of formal parameters and

otherwise This option must only b e sp ecied once for a

class

b if one lamb da list has a rest formal parameter then the

other lamb da list has a rest formal parameter to o and vice

versa

constructor constructorspec Creates a constructor

function for the new class The constructor sp ecication

An error is signalled condition

gives the name to which the constructor function will b e

class noncongruentlambdalistsifany metho d de

b ound followed by a sequence of legal initargs for the class

ned on this generic function do es not havealamb da list

The new function creates an instance of the class and lls

congruent to that of the generic function

in the slots according to the matchbetween the sp ecied

initargs and the given arguments to the constructor func

An error is

tion This option may b e sp ecied anynumb er of times

signalled condition class incompatiblemethoddomain

for a class

if the metho ds sp ecialized lamb da list widens the domain of

b da lists of all the generic function In other words the lam

predicate identier Creates a function which tests

metho ds must sp ecialize on sub classes of the classes in the

whether an ob ject is an instance of the new class The

lamb da list of the generic function

predicate sp ecication gives the name to which the predi

cate function will b e b ound This option may b e sp ecied

An error is signalled condition

anynumb er of times for a class

class methoddomainclashifany metho ds dened on

Programming Language EuLisp version

Table defgeneric rewrite rules

defgeneric identier gf lambda list defconstant identier

flevel init optiong genericlambda gf lambda list flevel init optiong

defgeneric setter identier gf lambda list setter setter identier

flevel init optiong genericlambda gf lambdalist flevel init optiong

defgeneric converter identier gf lambda list setter converter identier

flevel init optiong genericlambda gf lambda list level init optiong

this generic function have the same domain These condi

tions apply b oth to metho ds dened at the same time as the

defmethod form

generic function and to any metho ds added subsequently by

defmethod gf locator

specialized lambda list

defmethodAninitoption is an identier followed by a cor

form

resp onding value

gf locator

identifier

An error is signalled condition class

setter identifier

noapplicablemethod if an attempt is made to apply

converter identifier

a generic function which has no applicabl e metho ds for the

classes of the arguments supplied

The initoption is

Remarks

This macro is used for dening new metho ds on generic

method methodspec This option is followed by a

functions A new metho d ob ject is dened with the sp ec

metho d description A metho d description is a list com

ied b o dy and with the domain given by the sp ecialized

prising the sp ecialized lamb da list of the metho d which

lamb da list This metho d is added to the generic func

denotes the domain and a sequence of forms denoting

tion b ound to gfname whichisanidentier or a form

the metho d b o dy The metho d b o dy is closed in the lex

denoting a setter function or a converter function If

ical environmentinwhich the generic function denition

the sp ecialized lamb dal ist is not congruent with that of

app ears This option may b e sp ecied more than once

the generic function an error is signalled condition class

noncongruentlambdalists An error is signalled

The rewrite rules for defgeneric are given in Table condition class incompatiblemethoddomain if the

metho ds sp ecialized lamb da list would widen the domain

of the generic function If there is a metho d with the same

domain already dened on this gneric function an error is

signalled condition class methoddomainclash

Examples

In the following example of the use of defgeneric a generic

function named gf is dened with three metho ds attached

genericlambda macro

to it The domain of gf is constrained to b e object

classa In consequence each metho d added to the

generic function b oth here and later by defmethodmust

have a domain which is a sub class of object classa

Syntax

whichistosay that classc classe and classg

must all b e sub classes of classa

generic lambda form

genericlambdagflambdalist

defgeneric gf arg arg classa

level init option

method marg classb marg classc

method marg classd marg classe

method marg classf marg classg

Remarks

genericlambda creates and returns an anonymous generic

function that can b e applied immediatelymuchlike the nor

mal lambdaThegenlambdalist and the initoption s are in

terpreted exactly as for the level denition of defgeneric See also defmethod genericlambda

Examples

In the following example an anonymous version of gf see

defmethod macro

defgeneric ab ove is dened In all other resp ects the re

sulting ob ject is the same as gf

genericlambda arg object arg classa

method marg classb marg classc

Syntax

method marg classd marg classe

Programming Language EuLisp version

Remarks method marg classf marg classg

Signalled by one of defgeneric defmethod or

genericlambda if there would b e metho ds with the same

domain attached to the generic function

See also defgeneric

Sp ecializing Metho ds

noapplicablemethod teloscondition

The following two op erators are used to sp ecialize more gen

eral metho ds The more sp ecialized metho d can do some

additional computation b efore calling these op erators and

Initializatio n Options

can then carry out further computation b efore returning It

is an error to use either of these op erators outside a metho d

generic function The generic function whichwas ap

body Argument bindings inside metho ds are immutable

plied

Therefore an argument inside a metho d retains its sp ecial

ized class throughout the pro cessing of the metho d

arguments list The arguments of the generic function

whichwas applied

callnextmethod special form

Remarks

Signalled by a generic function when there is no metho d

Syntax

which is applicabl e to the arguments

callnextmethod

incompatiblemethoddomain teloscondition

Result

The result of calling the next most sp ecic applicabl e

Initializatio n Options

metho d

generic function The generic function to b e extended

Remarks

method method The metho d to b e added

The next most sp ecic applicable metho d is called with the

same arguments as the current metho d An error is signalled

condition class nonextmethod if there is no next most

Remarks

sp ecic metho d

Signalled by one of defgeneric defmethod or

genericlambda if the domain of the metho d would not b e

a sub domain of the generic functions domain

nextmethodp special form

Syntax

noncongruentlambdalists teloscondition

nextmethodp

Initializatio n Options

Result

generic function The generic function to b e extended

If there is a next most sp ecic metho d nextmethodp re

turns a non value otherwise it returns

method method The metho d to b e added

Remarks

nonextmethod teloscondition

Signalled by one of

defgeneric defmethod or genericlambda if the lambda

Initializatio n Options

list of the metho d is not congruent to that of the generic

function

method method The metho d which called

callnextmethod

methoddomainclash teloscondition

operandlist list A list of the arguments to havebeen

passed to the next metho d

Initializatio n Options

Remarks

generic function The generic function to b e extended

Signalled by callnextmethod ifthereisnonextmostspe

methods list The metho ds with the same domain

cic metho d

Programming Language EuLisp version

The rst two steps are usually called methodlookup and the Metho d Lo okup and Generic Dispatch

rst four are usually called generic dispatch

The system dened metho d lo okup and generic function dis

patch is purely class based eql metho ds known from CLOS

Creating and Initializing Ob jects

are excluded

Ob jects can b e created by calling

The application b ehaviour of a generic function can b e de

scrib ed in terms of methodlookup and generic dispatch The

constructors predened or user dened or

metho d lo okup determines

make the general constructor function or

a which metho ds attached to the generic function are

applicable to the supplied arguments and

allocate the general allo cator function

b the linear order of the applicabl e metho ds with re

sp ect to classes of the arguments and the argument prece

make function

dence order

A class C is called morespecic than class C with respect



Arguments

to C i C app ears b efore C in the class precedence list

 



CPL of C



class The class of the ob ject to create

Two additional concepts are needed to explain the pro

key obj key obj Initializa tion arguments

n n

cesses of metho d lo okup and generic dispatch i whether a

metho d is applicable ii how specic it is in relation to the

other applicable metho ds The denitions of each of these

Result

termsisnow given

An instance of class

A metho d with the domain D D listis ap

m

plicable to the arguments a a a a if the class

m m n

Remarks

of each argument C is a sub class of D whichistosay D

i i i

The general constructor make creates a new ob ject calling

is a member of C s class precedence list

i

allocate and initiali zes it by calling initialize make re

turns whatever allocate returns as its result

A metho d M with the domain D D list

m

is morespecic than a metho d M with the domain



D D list with respect to the arguments

 m

allocate function

a a a a i there exists an i  m so that

m m n

D is more sp ecic than D with resp ect to C the class of

i i i

and for all j i  D is not more sp ecic than a

i j

Arguments

D with resp ect to C the class of a

j j j

class A structure class

Now with the ab ove denitions we can describ e

the applicati on b ehaviour of a generic function f

initlist A list of initiali zati on arguments

a a a a

m m n

a Select the metho ds applicabl e to a a a a

m m n

Result

from all metho ds attached to f

A new uninitial i zed direct instance of the rst argument

b Sort the applicable metho ds M M into decreasing

k

order of sp ecicity using left to right argument precedence

Remarks

order to resolve otherwise equally sp ecic metho ds

The class must b e a structure class the initlist is ignored

The b ehaviour of allocate is extended at level for classes

c If callnextmethod app ears in one of the metho d

not accessible at level The level b ehaviour is not aected

b o dies make the sorted list of applicable metho ds avail

by the level extension

able for it

d Apply the most sp ecic metho d on

initialize generic function

a a a a

m m n

e Return the result of the previous step

Generic Arguments



This denition is required when comes

object object The ob ject to initialize

into play Then two classes have to b e compared with resp ect

to a third class even if they are not related to each other via

initlist The list of initiali zati on arguments

the sub class relationship Although multiple inheritance is not

provided at level the metho d lo okup proto col is indep endent

of the inheritance strategy dened on classes It dep ends on the

Result

class precedence lists of the domains of metho ds attached to the

generic function and the argument classes involved The initialize d ob ject

Programming Language EuLisp version

Remarks Concurrency

Initializes an ob ject and returns the initiali zed ob ject as the

result It is called by make on a new uninitia li zed ob ject The basic elements of parallel pro cessing in EULISP are pro

cesses and mutual exclusion which are provided bythe

created by calling allocate

classes thread and lock resp ectively

Users may extend initialize by dening metho ds sp ecial

The A thread is allo cated and initialized by calling make

izing on newly dened classes which are structure classes at

initarg of a thread sp ecies the initial function whichis

level

where execution starts the rst time the thread is dispatched

by the scheduler In this discussion four states of a thread are

identied new running aborted and nished These are for

initialize method

conceptual purp oses only and a EuLisp program cannot dis

tinguish b etween new and running or b etween ab orted and

Sp ecialized Arguments

nished Although accessing the result of a thread would

p ermit such a distinction retrosp ectively since an ab orted

object object The ob ject to initialize

thread will cause a condition to b e signalled on the access

ing thread and a nished thread will not In practice the

initlist The list of initial izati on arguments

running state is likely to haveseveral internal states but

these distinctions and the information ab out a threads cur

rent state can serve no useful purp ose to a running program

Result

since the information may b e incorrect as so on as it is known

The initializ ed ob ject

The initial state of a thread is new The union of the two

nal states is known as determined Although a program can

nd out whether a thread is determined or not by means of

Remarks

wait with a timeout of t denoting a p oll the information

This is the default metho d attached to initialize This

is only useful if the thread has b een determined

metho d p erforms the following steps

A thread is made available for dispatchby starting it using

a Checks if the supplied initargs are legal and signals

the function threadstartwhichchanges its state from new

an error otherwise Legal initargs are those sp ecied in

to running After running a thread b ecomes either nished

the class denition directly or inherited from a sup erclass

or ab orted When a thread is nished the result of the

An initarg may b e sp ecied as a slot option or as a class

initial function may b e accessed using threadvalueIfa

option

thread is ab orted which can only o ccur as a result of a signal

handled by the default handler installed when the thread is

b Initializes the slots of the ob ject according to the

created then threadvalue will signal the condition that

initarg if supplied or according to the most sp ecic

ab orted the thread on the thread accessing the value Note

initform if sp ecied Otherwise the slot remains un

that threadvalue susp ends the calling thread if the thread

b ound

whose result is sought is not determined

Legal initargs which do not initialize a slot are ignored by

While a thread is running its progress can b e susp ended

the default initialize metho d More sp ecic metho ds may

by accessing a lo c k by a stream op eration or by calling

handle these initargs and call the default metho d by calling

threadvalue on an undetermined thread In each of these

callnextmethod

cases threadreschedule is called to allow another thread

to execute This function may also b e called voluntarily

Progress can resume when the lo ck b ecomes unlo cked the in

Accessing Slots

putoutput op eration completes or the undetermined thread

b ecomes determined

Ob ject comp onents slots can b e accessed using reader and

writer functions accessors onlyFor system dened ob ject

The actions of a thread can b e inuenced externally by

classes there are predened readers and writers Some of

signal This function registers a condition to b e signalled

the writers are accessible using the setter function If there

no later than when the sp ecied thread is rescheduled for

is no writer for a slot its value cannot b e changed When

executionwhen threadreschedule returns The condi

users dene new classes they can sp ecify which readers and

tion must b e an instance of threadcondition Conditions

writers should b e accessible in a mo dule and bywhich bind

are delivered to the thread in order of receipt This ordering

ing Accessor bindings are not exp orted automatically when

requirement is only imp ortant in the case of a thread sending

a class binding is exp orted They can only b e exp orted

more than one signal to the same thread but in other cir

explicitly

cumstances the delivery order cannot b e veried A signal

on a determined thread has no discernable eect on either

the signalled or signalli ng thread unless the condition is not

an instance of threadcondition in which case an error

is signalled on the signalli ng thread See also Section

Alock is an abstract data typ e protecting a binary value

which denotes whether the lo ckislocked or unlo cked The

op erations on a lo ck are lock and unlock Executing a lock

op eration will eventually give the calling thread exclusive

control of a lo ck The unlock op eration unlo cks the lo ckso

that either a thread subsequently calling lock or one of the

Programming Language EuLisp version

Aweak but sucient guaranteeisthatifany thread resched threads which has already called lock on the lo ck can gain

ules innitely often then every other thread will b e scheduled exclusive access

innitely often Hence if a thread is waiting for shared data

NOTE Itisintended that implementationsoflocks based on

to b e changed by another thread and is using a lo ck the other

spinlo cks semaphores or channels should all b e capable of sat

thread is guaranteed to have the opp ortunitytochange the

isfying the ab ove description However to b e a conforming im

data If it is not using a lo ck the fairness guarantee en

plementation the use of a spinlo ckmust observe the fairness re

sures that in the same scenario the following lo op will exit

quirement which demands that b etween attempts to acquire the

eventually

lo ck control must b e ceded to the scheduler

while data threadreschedule

The programming mo del is that of concurrently executing

threads regardless of whether the conguration is a multi

pro cessor or not with some constraints and some weak fair

ness guarantees

Threads

a A pro cessor is free to use runtocompletion timeslic

ing andor concurrent execution

The dened name of this mo dule is thread This section

denes the op erations on threads

b A conforming program must assume the p ossibilityof

concurrent execution of threads and will have the same

semantics in all casessee discussion of fairness which fol

thread class

lows

c The default condition handler for a new thread when

The class of all instances of thread

invoked will change the state of the thread to aborted

save the signalled condition and reschedule the thread

Initializatio n Options

d A continuation must only b e called from within its

dynamic extent This do es not include threads created

initfunction fn an instance of function which

within the dynamic extent An error is signalled condi

will b e called when the resulting thread is started by

tion class wrongthreadcontinuation if a continu

threadstart

ation is called on a thread other than the one on whic hit

was created

threadp function

e The lexical environment inner and top asso ciated

with the initial function may b e shared as is the top

dynamic environment but each thread has a distinct

Arguments

innerdynamic environment In consequence any mo di

cations of bindings in the lexical environment or in the

object An ob ject to examine

topdynamic environment should b e mediated bylocks to

avoid nondeterministi c b ehaviour

Result

f The creation and starting of a thread represent

The supplied argument if it is an instance of threadoth

changes to the state of the pro cessor and as such are not

erwise

aected by the pro cessors handling of errors signalled sub

sequently on the creatingstarting thread cf streams

That is to say a nonlo cal exit to a p oint dynamicall y out

threadreschedule function

side the creation of the subsidiary thread has no default

eect on the subsidiary thread

This function takes no arguments

g The b ehaviour of io on the same stream bymultiple

threads is undened unless it is mediated by explicit lo cks

Result

The parallel semantics are preserved on a sequential runto

The result is

completion implementation by requiring communication b e

tween threads to use only thread primitives and shared data

protected bylocksb oth the thread primitives and lo cks will

Remarks

cause rescheduling so other threads can b e assumed to have

achance of execution

This function is called for sideeect only and may cause the

thread which calls it to b e susp ended while other threads

There is no guarantee ab out which thread is selected next

are run In addition if the threads condition queue is not

However a fairness guarantee is needed to provide the il

empty the rst condition is removed from the queue and

lusion that every other thread is running A strong guar

signalled on the thread The resume continuation of the

antee would ensure that every other thread gets scheduled

signal will b e one which will eventually call the continuation

b efore a thread whichreschedules itself is scheduled again

of the call to threadreschedule

Suchascheme is usually called roundrobin This could

vided by a parallel imple b e stronger than the guarantee pro

mentation or the scheduler of the host op erating system and See also threadvalue signal and Section

cannot b e mandated in this denition for details of conditions and signalli ng

Programming Language EuLisp version

Result

currentthread function

Result is either thread or Iftimeout is the result

is thread if it is determined If timeout is t thread sus

p ends until thread is determined and the result is guaran

This function takes no arguments

teed to b e threadIftimeout is a nonnegativeinteger the

call blo cks until either thread is determined in which case

the result is threadoruntil the timeout p erio d is reached

Result

in which case the result is whichev er is the so oner The

The thread on which currentthread was executed

units for the nonnegativeinteger timeout are the number

of clo ckticks to wait The implementation dene d constant

tickspersecond is used to make timeout p erio ds pro ces

threadstart function

sor indep endent

Arguments

See also wait and tickspersecond Sec

tion

thread the thread to b e started whichmust b e new If

thread is not new an error is signalled condition class

threadalreadystarted

threadcondition condition

obj obj values to b e passed as the arguments to the

n

initial function of thread

Initializatio n Options

Result

currentthread thread The thread whichissignalling

The thread whichwas supplied as the rst argument

the condition

Remarks

Remarks

The state of thread is changed to running The values obj

This is the general condition class for all conditions arising

to obj will b e passed as arguments to the initial function of

n

from thread op erations

thread

threadvalue function

wrongthreadcontinuation threadcondition

Arguments

Initializatio n Options

thread the thread whose nished value is to b e accessed

continuation continuation Acontinuation

Result

thread thread The thread on which continuation was

created

The result of the initial function applied to the arguments

passed from threadstartHowever if a condition is sig

nalled on thread which is handled by the default handler

the condition will now b e signalled on the thread calling

Remarks

threadvaluethat is the condition will b e propagated to

Signalled if the given continuation is called on a thread other

the accessing thread

than the one on whichitwas created

Remarks

threadalreadystarted threadcondition

If thread is not determined each thread calling threadvalue

is susp ended until thread is determined when each will either

get the threads value or signal the condition

Initializati on Options

See also threadreschedule signal

thread thread A thread

wait method

Remarks

Signalled by threadstart if the given thread has b een

started already

Sp ecialized Arguments

thread thread The thread on whichtowait

Lo cks

timeout object The timeout p erio d which is sp ec

ied by one of t and nonnegativeinteger

The dened name of this mo dule is lock

Programming Language EuLisp version

Conditions

lock class

The dened name of this mo dule is condition

The class of all instances of lock This class has no init

The condition system was inuenced by the Common Lisp

options The result of calling make on lock is a new op en

error system and the Standard ML exception mechanism

lo ck

It is a simplicati on of the former and an extension of the lat

ter Following standard practice this text denes the actions

of functions in terms of their normal b ehaviour Where an

lockp function

exceptional b ehaviour might arise this has b een dened in

terms of a condition However not all exceptional situations

are errors Following Pitman weuse condition to b e a kind

Arguments

of o ccasion in a program when an exceptional situation has

b een signalled An error is a kind of conditionerror and

object An ob ject to examine

condition are also used as terms for the ob jects that rep

resent exceptional situations A condition can b e signalled

continuably by passing a continuation for the resumption to

Result

signal If a continuation is not supplied then the condition

The supplied argumentifitisaninstanceoflock otherwise

cannot b e continued

These two categories are characterized as follows

lock function

a A condition might b e signalled when some limit has

b een transgressed and some correctiveactionisneeded

b efore pro cessing can resume For example memory zone

Arguments

exhaustion on attempting to heapallo cate an item can

b e corrected by calling the memory managementscheme

lock the lo ck to b e acquired

ver dead space However if no space was recov to reco

ered a new kind of condition has arisen Another example

arises in the use of IEEE oating p oint arithmetic where

Result

a condition might b e signalled to indicate divergence of

The lo ck supplied as argument

an op eration A condition should b e signalled continuably

when there is a strategy for recovery from the condition

Remarks

b Alternatively a condition might b e signalled when

Executing a lock op eration will eventually give the calling

some catastrophic situation is recognized such as the

thread exclusivecontrol of lock A consequence of calling

memory manager b eing unable to allo cate more memory or

lock is that a condition from another thread may b e sig

unable to recover sucient memory from that already al

nalled on this thread Such a condition will b e signalled

lo cated A condition should b e signalled noncontinuably

b efore lock has b een acquired so a thread whichdoesnot

when there is no reasonable way to resume pro cessing

handle the condition will not lead to starvation the con

dition will b e signalled continuably so that the pro cess of

A condition class is dened using defcondition see Sec

acquiring the lo ckmay continue after the condition has b een

tion The denition of a condition causes the creation

handled

of a new class of condition A condition is signalled using

the function signalwhich has two required arguments and

one optional argument an instance of a condition a re

See also unlock and Section for details of con

sume continuation or the empty listthe latter signifying a

ditions and signalli ng

noncontinuable signaland a thread A condition can b e

handled using the sp ecial form withhandlerwhichtakes a

functionthe handler functionand a sequence of forms to

unlock function

b e protected The initial condition class hierarchy is shown

in Figure

Arguments

Condition Classes

lock the lo ck to b e released

condition class

Result

The lo ck supplied as argument

Initializatio n Options

message string A string containing information

Remarks

which should p ertain to the situation which caused the

The unlock op eration unlo cks lock so that either a thread

condition to b e signalled

subsequently calling lock or one of the threads which has

already called lock on the lo ck can gain exclusive access

Remarks

The class which is the sup erclass of all condition classes See also lock

Programming Language EuLisp version

condition

Result

executioncondition

invalidoperator

Returns object if it is a condition otherwise

cannotupdatesetter

nosetter

environmentcondition

arithmeticcondition

initialize method

divisionbyzero

conversioncondition

noconverter

Sp ecialized Arguments

streamcondition

syntaxerror

condition condition a condition

threadcondition

threadalreadystarted

initlist A list of initiali zati on options as follows

wrongthreadcontinuation

wrongconditionclass

teloscondition

message string A string containing information

nonextmethod

which should p ertain to the situation which caused the

noncongruentlambdalists

condition to b e signalled

n incompatiblemethoddomai

noapplicablemethod

methoddomainclash

Result

Figure Level initial condition class hierarchy

A new initiali zed condition

Remarks

executioncondition condition

First calls callnextmethod to carry out initiali zatio n sp ec

ied by sup erclasses then do es the condition sp ecic ini

tialization The following initoption is recognized bythis

This is the general condition class for conditions arising from

metho d

the execution of programs by the pro cessor

message string A string which should contain informa

tion ab out the condition that has arisen

domaincondition executioncondition

Initializatio n Options

defcondition dening form

argument object An argument whichwas not of the

exp ected class or outside a dened range and therefore

Syntax

lead to the signalli ng of this condition

defcondition conditionclassname superclassname init

option

rangecondition executioncondition

Arguments

Initializatio n Options

conditionclassname Asymb ol naming a binding to b e

initiali zed with the new condition class

result object A result whichwas not of the ex

p ected class or outside a dened range and therefore lead

superclassname A symb ol naming a binding of a class

to the signalli ng of this condition

to b e used as the sup erclass of the new condition class

initoption A sequence of symb ols and expressions

to b e passed to then generic functions allocate and

environmentcondition condition

initialize

This is the general condition class for conditions arising from

the environment of the pro cessor

Remarks

This dening form denes a new condition class The rst

argument is the name to which the new condition class will

conditionp function

b e b ound The second is the name of the sup erclass of the

new condition class and an initoption is an identier fol

lowed by its default initial value If superclassname is

Arguments

the sup erclass is taken to b e condition Otherwise

superclassname must b e condition or the name of one of

object An ob ject to examine

its sub classes

Programming Language EuLisp version

condition condition A condition Condition Handling

Signalled by signal if the given condition is not an instance

Conditions are handled with a function called a hand ler

of the condition class threadcondition

Handlers are established dynamicall y and have dynamic

scop e and extent Thus when a condition is signalled the

pro cessor will call the dynamically closest handler This can

accept resume or decline the condition see withhandler

withhandler special form

for a full discussion and denition of this terminology If it

declines then the next dynamically closest handler is called

Syntax

and so on until a handler accepts or resumes the condition

It is the rst handler accepting the condition that is used

withhandler hand lerfunction protectedform

and this may not necessarily b e the most sp ecic Handlers

are established by the sp ecial form withhandler

Arguments

hand lerfunction A function or a generic function which

signal function

will b e called if a condition is signalled during the dy

namic extentofprotectedforms A handler function

takes two argumentsa condition and a resume func

Arguments

tioncontinuati on The condition is the condition ob ject

that was passed to signal as its rst argument The re

condition The condition to b e signalled

sume continuation is the continuation or that was

given to signal as its second argument

function The function to b e called if the condition is

handled and resumed that is to say the condition is con

protectedform The sequence of forms whose execution

tinuable or otherwise

is protected by the hand lerfunction sp ecied ab ove

thread If this argument is not supplied the condition

is signalled on the thread which called signal otherwise

Result

thread indicates the thread on which condition is to b e

The value of the last form in the sequence of protectedforms

signalled

Remarks

Result

A withhandler form is evaluated in four steps

signal should never return It is an error to call signals

continuation

a The new hand lerfunction is constructed and identies

the dynamicall y closest handler

Remarks

b The dynamicall y closest handler is shadowed by the

Called to indicate that a sp ecied condition has arisen during

establishment of the new hand lerfunction

the execution of a program

c The sequence of protectedformsisevaluated in order

If the third argument is not supplied signal calls the dy

and the value of the last one is returned as the result of

namically closest handler with condition and continuation

the withhandler expression

If the second argument is a sub class of functionitisthe

resume continuation to b e used in the case of a handler de

d the hand lerfunction is disestablish ed and the previ

ciding to resume from a continuable condition If the second

ous handler is no longer shadowed

argumentis it indicates that the condition was signalled

as a noncontinuable conditioni n this way the handler is

The ab ove is the normal b ehaviour of withhandler The

informed of the signalers intention

exceptional b ehaviour of withhandler happ ens when there

is a call to signal during the evaluation of protectedform

If the third argument is supplied signal registers the

signal calls the dynamicall y closest hand lerfunction pass

The sp ecied condition to b e signalled on thread

ing on the rst two arguments given to signal The hand ler

condition must b e an instance of the condition class

function is executed in the dynamic extent of the call to

threadcondition otherwise an error is signalled condi

signalHowever any signals o ccurring during the exe

tion class wrongconditionclass on the thread calling

cution of hand lerfunction are dealt with by the dynami

signalAsignal on a determined thread has no eect on

cally closest handler outside the extent of the form which

either the signalled or signallin g thread except in the case of

established hand lerfunctionAhand lerfunction takes one

the ab ove error

of three actions

Return This causes the nextclosest enclosing a

See also threadreschedule threadvalue

hand lerfunction to b e called passing on the condition

withhandler

and the resume continuation This is termed declining

the condition The situation when there is no next closest

enclosing handler is discussed later

wrongconditionclass threadcondition

b Call the resume continuation This action mightbe

taken if the condition is recognized by the handler function Initializ atio n Options

Programming Language EuLisp version

letcc accept

signal with an instance of a condition of conditionclass

withhandler

initiali zed from initoption s the errormessage and a resume

genericlambda

continuation value of signifying that the condition was

condition condition resume function

not signalled continuably

method

c condition resume

cond

seriousp c

cerror function

serious error exit from withhand ler accept

accept

fixablep c

Arguments

xable error resume

resume fix c

errormessage a string containing relevant information

t

otherwise by omission let another hand ler deal

conditionclass the class of condition to b e signalled

with it decline

initoption a sequence of options to b e passed to

the protected expression

somethingwhichmightsignalanerror initializeinstance when making the instance of con

dition

Figure Illustration of handler actions

Result

The result is

and might b e preceded by some corrective action This is

termed resuming the condition

Remarks

The cerror function signals a continuable error It calls

c Not return and not call the resume continuation This

signal with an instance of a condition of conditionclass

action mightbetaken if the condition is recognized by the

initiali zed from initoption s the errormessage and a resume

handler function and might b e preceded by some corrective

continuation value which is the continuation of the cerror

action b efore some kind of transfer of control This is

expression A non resume continuation signies that the

termed accepting the condition

condition has b een signalled continuably

It is an error if the condition is declined and there is no next

closest enclosing handler In this circumstance the identied

error is delivered to the conguration to b e dealt with in an

implementationde ned way Errors arising in the dynamic

extent of the handler function are signalled in the dynamic

signal but are handled in the enclosing extent of the original

dynamic extent of the handler

Examples

An illustration of the use of all three cases is given in Fig

ure

See also signal

error function

Arguments

errormessage a string containing relevant information

conditionclass the class of condition to b e signalled

initoption a sequence of options to b e passed to

initializeinstance when making the instance of con

dition

Result

The result is

Remarks

The error function signals a noncontinuabl e error It calls

Programming Language EuLisp version

Expressions Denitions and Control

t symbol

Forms

This section gives the syntax of wellformed expressions and

Remarks

describ es the semantics of the sp ecialforms functions and

macros of the level language In the case of level macros

The symbol t is dened to b e immutably b ound to the sym

the description includes a set of expansion rules However

bol tThismay b e used to denote the abstract b o olean value

these descriptions are not prescriptiveofany pro cessor and

true but so mayany other value than

a conforming program cannot rely on adherence to these ex

pansions

symbol syntax

Simple Expressions

The current lexical binding of symbol is returned A symbol

can also name a dened constantthat is an immutable

constant syntax

toplexical binding

There are two kinds of constants literal constants and de

ned constants Only the rst kind are considered here A

deflocal dening form

literal constant isanumb er a string a character or the

empty list The result of pro cessing such a literal constant

is the constant itselfthat is it denotes itself

Syntax

Examples

deflocal form

the empty list

deflocal identifier form

a xed precision integer

a acharacter

abc a string

Arguments

defconstant dening form

identier Asymb ol naming a binding containing the

value of form

form The form whose value will b e stored in the binding Syntax

of identier

defconstant form

defconstant identifier form

Remarks

The value of form is stored in the toplexical binding of iden

tier The binding created byadeflocal form is mutable

Arguments

See also setq

identier A symb ol naming an immutable toplexical

binding to b e initiali zed with the value of form

form The form whose value will b e stored in the binding

quote special form

of identier

Remarks

Syntax

quote form

The value of form is stored in the toplexical binding of iden

quote object

tier It is a static error to attempt to mo dify the binding

of a dened constant

Arguments

nil null

object the object to b e quoted

Remarks

The symbol nil is dened to b e immutably b ound to the

Result

empty list which is represented as The empty list is

The result is object used to denote the abstract b o olean value false

Programming Language EuLisp version

Remarks

defmacro form

The result of pro cessing the expression quote object is

defmacro macro name lambda list

object The object canbeany ob ject having an external

form

representation The sp ecial form quote can b e abbreviated

using apostrophegraphic representation so that quote

a can b e written a These two notations are used to incor

p orate literal constants in programs It is an error to mo dify

a literal expression

Arguments

macroname A symb ol naming an immutable top

Functions creation denition and appli

lexical binding to b e initiali zed with a function having the

cation

sp ecied lambdalist and body

lambdalist The parameter list of the function conform

lambda special form

ing to the syntax sp ecied under lambda

Syntax

body A sequence of forms

lambda form

lambda lambda list form

Remarks

lambda list

The defmacro form denes a function named by macroname

identifier A

and stores the denition as the toplexical binding of macro

simple list

name The interpretation of the lambdalist is as dened for

rest list

lambda see Table

simple list

identifier A

NOTE A macro is automatically exp orted from the the mo dule

rest list

which denes it A macro cannot b e used in the mo dule which

identifier identifier

denes it

See also lambda

Arguments

lambdalist The parameter list of the function conform

ing to the syntax sp ecied in Table

defun syntax

form An expression

Syntax

Result

A function with the sp ecied lambdalist and sequence of

defun form

form s

simple defun

setter defun

simple defun

Remarks

defun function name lambda list

The function construction op erator is lambda Access to the

form

setter defun

lexical environment of denition is guaranteed The syntax

defun

of lambdalist is dened by the grammar in Table

setter function name

lambda list form

If lambdalist is an identier it is b ound to a newly allo cated

list of the actual parameters This binding has lexical scop e

and indenite extent If lambdalist is a simplelist the argu

ments are b ound to the corresp onding identiers Otherwise

lambdalist must b e a restlist In this case each identier

Arguments

preceding the dot is b ound to the corresp onding argument

and the identier succeeding the dot is b ound to a newly

functionname A symb ol naming an immutable top

allo cated list whose elements are the remaining arguments

lexical binding to b e initiali zed with a function having the

These bindings have lexical scop e and indenite extent It is

sp ecied lambdalist and body

a static error if the same identier app ears more than once

in a lambdalist It is an error to mo dify restlist

setter functionname An expression denoting the

setter function to corresp ond to functionname

defmacro syntax

lambdalist The parameter list of the function conform

ing to the syntax sp ecied under lambda

body A sequence of forms

Syntax

Programming Language EuLisp version

operandlist list The op erands prepared for the op er Remarks

ator

The defun form denes a function named by functionname

and stores the denition i as the toplexical binding of

functionname or ii as the setter function of functionname

Remarks

The interpretation of the lambdalist is as dened for lambda

Signalled by function call if the op erator is not an instance

The rewrite rules for defun are given b elow

of function

apply function

defun identier defconstant identier

lambdalist lambda lambdalist body

body

defun setter setter identier

Syntax

setter identier lambda lambdalist body

lambdalist body

apply form

apply function form

function call syntax

Arguments

Syntax

function An expression whichmust evaluate to an in

stance of function

function call form

form form A sequence of expressions which will

n

operator operand

be evaluated according to the rules given in function cal l

form An expression whichmust evaluate to a prop er

n

list It is an error if obj is not a prop er list

n

Arguments

operator This may b e a symb olb eing either the name

Result

of a sp ecial form or a lexical variableor a function call

The result is the result of calling function with the actual

whichmust result in an instance of function

parameter list created by app ending form to a list of the

n

arguments form through form An error is signalled

An error is signalled condition class

n

condition class invalidoperator if the rst argument

invalidoperator if the op erator is not a function

is not an instance of function

operand Each operand must b e either an atomic ex

pression a literal expression or a function call

See also function cal l invalidoperator

Result

Destructive Op erations

The result is the value of the application of operator to the

evaluation of operand

An assignment op eration mo dies the contents of a binding

named by a identierthat is a variable

Remarks

The operand expressions are evaluated in order from left to

setq special form

right The operator expression maybeevaluated at any time

b efore during or after the evaluation of the op erands

NOTE The ab ove rule for the evaluation of function calls was

Syntax

nally agreed up on for this version since it is in line with one

strand of common practice but it may b e revised in a future

version

setq form

setq identifier form

See also constant symbol quote

Arguments

invalidoperator executioncondition

identier The identier whose lexical binding is to b e

up dated

Initializ atio n Options

form An expression whose value is to b e stored in the

invalidoperator object The ob ject whichwas b eing

binding of identier

used as an op erator

Programming Language EuLisp version

Remarks Result

The result is the value of form

Signalled by setter setter if the up dater of the given

accessor is immutable

Remarks

The form is evaluated and the result is stored in the closest

See also setter

lexical binding named by identier It is a static error to

mo dify an immutable binding

Conditional Expressions

setter function

if special form

Arguments

Syntax

reader An expression whichmust evaluate to an in

stance of function

if form

if antecedent consequent

Result

alternative

The writer corresp onding to reader

Remarks

Arguments

A generalized place up date facilityisprovided by setter

Given reader setter returns the corresp onding up date func

antecedent A form

tion If no suchfunctionisknown to setter an error is sig

nalled condition class nosetter Thus setter car

consequent A form

returns the function to up date the car of a pair New up

date functions can b e added by using setters up date func

tion which is accessed by the expression setter setter

alternative A form

Thus setter setter areader awriter installs the

function whichisthevalue of awriter as the writer of

the reader function whichisthevalue of areader All

Result

writer functions in this denition and userdened writers

have the same immutable status as other standard functions

Either the value of consequence or alternative dep ending on

such that attempting to redene such a function for exam

the value of antecedent

ple setter setter car anewvalue signals an error

condition class cannotupdatesetter

Remarks

See also defgeneric defmethod defstruct

The antecedent is evaluated If the result is true the conse

defun

quence is evaluated otherwise the alternative is evaluated

Both consequence and alternative must b e sp ecied The

result of if is the result of the evaluation of whichever of

consequence or alternative is chosen

nosetter executioncondition

Initializatio n Options

cond macro

object object The ob ject given to setter

Remarks

Syntax

Signalled by setter if there is no up dater for the given func

tion

cond macro

cond

antecedent consequent

cannotupdatesetter executioncondition

Initializatio n Options

Remarks

accessor object The given accessor ob ject

The cond macro provides a convenient syntax for collections

of ifthenelseifelse expressions The rewrite rules for cond

updater object The given up dater ob ject



are given b elow

Programming Language EuLisp version

cond or

cond antecedent or antecedent cond or form form

cond or antecedent or form form let x form



antecedent cond if x

antecedent form antecedent form x

 

or form



cond if antecedent

antecedent form progn form

antecedent form cond



antecedent form



Variable Binding and Sequences

letcc special form

and macro

Syntax

Syntax

letcc form

letcc identifier form

and macro

and form

Arguments

identier To b e b ound to the continuation of the letcc

Remarks

form

The expansion of an and form leads to the evaluation of the

sequence of forms from left to right The rst form in the

body A sequence of forms

sequence that evaluates to stops evaluation and none of

the forms to its right will b e evaluatedthat is to sayitis

nonstrict The result of and is If none of the forms

Result

evaluate to the value of the last form is returned The

The result of evaluating the last form in body or the value of

rewrite rules for and are given b elow

the argumentgiven to the continuation b ound to identier

Remarks

and t

and form form

The identier is b ound to a new lo cation which is initial

and form form if form



ized with the continuation of the letcc form This binding

and form



is immutable and has lexical scop e and indenite extent

Each form in body is evaluated in order in the environment

extended by the ab ove binding It is an error to call the

continuation outside the dynamic extentoftheletcc form

that created it The continuation is a function of one argu

ment Calling the continuation causes the restoration of the

or macro

lexical environment and dynamic environment that existed

b efore entering the letcc form

Syntax

Examples

An example of the use of letcc is given in Figure The

or macro

function pathopen takes a list of paths the name of a le

or form

and list of options to pass to open It tries to op en the le

by app ending the name to each path in turn Eachtime

as not found open fails it signals a condition that the le w

which is trapp ed by the handler function That calls the

Remarks

continuation b ound to fail to cause it to try the next path in

the list When open do es nd a le the continuation b ound

The expansion of an or form leads to the evaluation of the

to succeed is called with the stream as its argument which sequence of forms from left to right The value of the rst

is subsequently returned to the caller of pathopen If the

form that evaluates to true is the result of the or form and

path list is exhausted map section A terminates and an none of the forms to its right will b e evaluatedthat is to

error condition class cannotopenpath is signalled

say it is nonstrict If none of the forms evaluate to true

the value of the last form is returned The rewrite rules for

or are given b elow Note that x do es not o ccur free in any

See also block returnfrom of form form

 n

Programming Language EuLisp version

defun pathopen pathlist name options

Remarks

letcc succeed

In returnfrom the identier names the continuation of the

map

lexical block from which to return returnfrom is the

lambda path

invo cation of the continuation of the blo ck named by identi

letcc fail

withhandler

er The form is evaluated and the value is returned as the

lambda condition resume fail

value of the blo ck named by identier The rewrite rules for

succeed apply open

returnfrom are given b elow

format nil aa path name

options

pathlist

error

returnfrom identier identier

format nil

returnfrom identier form

pathopen cannot open stream for a a

identier form

pathlist name

cannotopenpath

Figure Example using letcc

See also block

labels special form

block macro

Syntax

Syntax

labels form

labels

block macro

function definition

block identifier form

form

function definition

identifier lambda list form

Remarks

The blo ck expression is used to establish a statically scop ed

Arguments

binding of an escap e function The blo ck variable is b ound

to the continuation of the blo ck The continuation can b e

identier A symb ol naming a new innerlexical binding

invoked anywhere within the blo ckby using returnfrom

to b e initial ized with the function having the lambdalist The forms are evaluated in sequence and the value of the

and body sp ecied

last one is returned as the value of the blo ck form See also

letcc The rewrite rules for block are given b elow

lambdalist The parameter list of the function conform

The rewrite for block do es not preventtheblock b eing ex

ing to the syntax sp ecied b elow

ited from anywhere in its dynamic extent since the function

b ound to identier is a rstclass item and can b e passed as

body A sequence of forms

an argument like other values

labelsbody A sequence of forms

block identier

Result

block identier form letcc identier form

The labels op erator provides for lo cal mutually recursive

function creation Each identier is b ound to a new inner

lexical binding initiali zed with the function constructed from

lambdalist and body The scop e of the identiers is the entire

See also returnfrom

labels form The lambdalist is either a single variable or

a list of variablessee lambda Each form in labelsbody is

evaluated in order in the lexical environment extended with

the bindings of the identiers The result of evaluating the

returnfrom macro

last form in labelsbody is returned as the result of the labels

form

Syntax

let macro

return from macro

returnfrom identifier form

Syntax

Programming Language EuLisp version

let form progn form

let macro

let var form let var form

let identifier binding

var form let var form

form    

var var

binding  

identifier

form form

identifier form

Remarks

progn special form

The optional identier denotes that the let form can b e

called from within its body This is an abbreviation for

labels form in which identier is b ound to a function whose

Syntax

parameters are the identiers of the binding s of the let

whose b o dy is that of the let and whose initial call passes

the values of the initiali zin g form of the binding s A bind

progn form

ing is sp ecied by either an identieroratwo element list

progn form

of an identier and an initiali zi ng form All the initializi ng

forms are evaluated in order from left to right in the current

environment and the variables named by the identiers in

the bindings are b ound to new lo cations holding the results

Arguments

Each form in body is evaluated in order in the environment

extended by the ab ove bindings The result of evaluating the

form A sequence of forms and in certain circum

last form in body is returned as the result of the let form

stances dening forms

The rewrite rules for let are given b elow

let form progn form

Result

let id form lambda id id id

 

The sequence of formsisevaluated from left to right return

id form form

 

ing the value of the last one as the result of the progn form

id form form

 

If the sequence of forms is empty progn returns

form

let id labels



id form id id id

 

Remarks

id form



id form

If the progn form o ccurs enclosed only by progn forms and



form

a defmodule form then the forms within the progn can b e

dening forms since they app ear in the toplexical environ

ment It is a static error for dening forms to app ear in

innerlexical environments

let macro

unwindprotect special form

Syntax

Syntax

let star macro

let binding form

unwind protect form

unwindprotect protected form

after form

Remarks

Arguments

A binding is sp ecied byatwo elementlistofavariable and

an initiali zin g form The rst initiali zin g form is evaluated

in the currentenvironment and the corresp onding variable is

protectedform A form

b ound to a new lo cation containing that result Subsequent

bindings are pro cessed in turn evaluating the initializi ng

afterform A sequence of forms

form in the environment extended by the previous binding

Each form in body is evaluated in order in the environment

extended by the ab ove bindings The result of evaluating

Result

the last form is returned as the result of the let form The

The value of protectedform rewrite rules for let are given b elow

Programming Language EuLisp version

progn

Remarks

letcc k

wait provides a generic interface to op erations whichmay

labels

blo ck Execution of the current thread will continue b eyond

loop

the wait form only when one of the following happ ened

letcc k unwindprotect k k

continuation bound to k

loop

a A condition asso ciated with obj returns true

loop

continuation bound to k

b timeout time units elapse

c A condition is raised by another thread on this thread

Figure Interaction of unwindprotect with non

lo cal exits

wait returns if timeout o ccurs else it returns a nonnil

value

A timeout argumentof or zero denotes a p olling op era

Remarks

tion A timeout argumentoft denotes indenite blo cking

cases a or c ab ove A timeout argument

The normal action of unwindprotect is to pro cess protected

of a nonnegativeinteger denotes the minimum number of

form and then eachofafterforms in order returning the

time units b efore timeout The numb er of time units in

value of protectedform as the result of unwindprotectA

a second is given by the implementation den ed constant

nonlo cal exit from the dynamic extentofprotectedform

ticksper second

which can b e caused by pro cessing a nonlo cal exit form

will cause eachofafterforms to b e pro cessed b efore con

trol go es to the continuation sp ecied in the nonlo cal exit

Examples

form The afterforms are not protected in anywayby the

This co de fragmentcopiescharacters from stream s to the

current unwindprotect Should any kind of nonlo cal exit

current output stream until no data is received on the stream

o ccur during the pro cessing of the afterforms the after

for a p erio d of at least second

forms b eing pro cessed are not reentered Instead control is

transferred to wherever sp ecied by the new nonlo cal exit

but the afterform sofanyintervening unwindprotectsbe

labels

loop tween the dynamic extent of the target of control transfer

when wait s round tickspersecond

and the current unwindprotect are evaluated in increasing

print readchar s

order of dynamic extent

loop

loop

Examples

See also threads section streams sec

The co de fragment in Figure illustrates b oth the use of

tion A

unwindprotect and of a dierence b etween the semantics

of EULISP and some other Lisps Stepping through the eval

uation of this form k is b ound to the continuation of its

tickspersecond doublefloat

letcc form a recursive function named loop is constructed

loop is called from the b o dy of the labels form k is b ound

to the continuation of its letcc form unwindprotect calls

The numb er of time units in a second expressed as a

k the after forms of unwindprotect are evaluated in or

double precision oating p ointnumber This value is

der k is called loop is called etc This program lo ops

implementationde ned

indenitely

Quasiquotation Expressions

Events

quasiquote macro

The dened name of this mo dule is event

wait generic function

Syntax

Generic Arguments

quasiquote macro

quasiquote skeleton

obj An ob ject

timeout object One of t or a nonnegative in

teger Remarks

Quasiquotation is also known as backquoting A

quasiquoted expression is a convenientwayofbuildinga

Result

structure The skeleton describ es the shap e and generally

Returns if timeout was reached otherwise a non value manyoftheentries in the structure but some holes remain

Programming Language EuLisp version

Syntax of Level dening forms to b e lled The quasiquote macro can b e abbreviated by

using the glyph called grave accent so that quasiquote

expression can b e written expression

module

defmodule module name

module directives module form

module name

unquote syntax

identifier A

module directives

module directive

module directive

Syntax

export identifier

expose module descriptor

import module descriptor

unquote syntax

syntax module descriptor

unquote form

level module form

form

export identifier

level expression

defining form

progn module form

Remarks

module descriptor

module name

See unquotesplicing

module filter

module filter

except identifier

unquotesplicing syntax

module descriptor

only identifier

module descriptor

rename rename pair

Syntax

module descriptor

rename pair

identifier identifier

unquotespliceing syntax

unquotesplicing form

form

defstruct form

defstruct class name superclass name

slot description list class option

class name

Remarks

identifier A

The holes in a quasiquoted expression are identied by un

superclass name

quote expressions of which there are two kindsforms whose

identifier A

slot description list

value is to b e inserted at that lo cation in the structure and

slot decsription

forms whose value is to b e spliced into the structure at that

slot description

lo cation The former is indicated byan unquote expres

slot name

sion and the latter byanunquotesplicing expression In

slot name slot option

unquotesplice the form must result in a prop er list The

slot name

insertion of the result of an unquotesplice expression is as if

identifier A

the op ening and closing parentheses of the list are removed

slot option

and all the elements of the list are app ended in place of the

initarg identifier A

unquotesplice expression

initform level expression

reader identifier A

writer identifier A

The syntax forms unquote and unquotesplicing can b e

accessor identifier A

abbreviated resp ectively by using the glyph called comma

class option

preceding an expression and by using the diphthong

initargs identifier

comma followed by the glyph called commercial at pre

constructor identifier

ceding a form Thus unquote a maybewrittena and

initarg name

unquotesplicingacan b e written a

predicate identifier A

Examples

a list b a b

a list b a b

Summary of Level Expressions and Def

initions

This section gives the syntax of all lev el expressions and

denitions together The syntax of data ob jects is given

in the section p ertaining to the class and is summarized in

section A

Programming Language EuLisp version

defgeneric form lambda form

defgeneric gf name gf lambda list lambda lambda list form

level init option lambda list

gf name identifier A

identifier A simple list

gf lambda list rest list

specialized lambda list simple list

level init option identifier A

method method description rest list

identifier method description identifier

specialized lambda list form

specialized lambda list

specialized parameter

function call form

specialized parameter

operator operand

identifier A

specialized parameter

identifier class name A

quote form

identifier A

quote object

defmethod form

setq form

defmethod gf locator

setq identifier form

specialized lambda list

form

gf locator

identifier

if form

setter identifier

if antecedent consequent

converter identifier

alternative

defconstant form

letcc form

defconstant identifier form

letcc identifier form

deflocal form

labels form

deflocal identifier form

labels

function definition

form

function definition

defmacro form

identifier lambda list form

defmacro macro name lambda list

form

progn form

progn form

defun form

simple defun

setter defun

simple defun

unwind protect form

defun function name lambda list

unwindprotect protected form

form

after form

setter defun

defun

setter function name

apply form

lambda list form

apply function form

Syntax of Level expressions

Syntax of Level macros

generic lambda form

cond macro

genericlambda gf lambda list

cond

level init option

antecedent consequent

and macro

and form

or macro

or form

Programming Language EuLisp version

block macro

block identifier form

return from macro

returnfrom identifier form

let macro

let identifier binding

form

binding

identifier

identifier form

let star macro

let binding form

quasiquote macro

quasiquote skeleton

unquote syntax

unquote form

form

unquotespliceing syntax

unquotesplicing form

form

Programming Language EuLisp version

Annex A

normative

Level Mo dule Library

Table A Character Syntax

A Characters

The dened name of this mo dule is character

character token

literal character token

special character token

A character syntax

control character token

numeric character token

literal character token

Character literals are denoted by the extension glyph called

letter

hash followed by the characterextension glyph called

decimal digit

reverse solidus followed by the name of the character

nonalphabetic

The syntax for the external representation of characters is

control character token

dened in Table A For most characters their name is the

letter

same as the glyph asso ciated with the character for example

special character token

alert

the character a has the name a and has the external

backspace

representation a Certain characters in the group named

delete

special see Table and also Table havesymb olic names

formfeed

for example the newline character has the name new line and

linefeed

has the external representation newline These sp ecial

newline

cases are the characters in the pro duction special character

return

token in Table A

tab

space

Anycharacter whichdoesnothave a name and therebyan

verticaltab

numeric character token

external representation dealt with by cases describ ed so far

x hex digit

is represented by x followed by up to four hexadecimal

x hex digit hex digit

digits The value of the hexadecimal numb er represents the

x hex digit hex digit hex digit

p osition of the character in the currentcharacter set Exam

x hex digit hex digit hex digit

ples of suchcharacter literals are x and xabcdwhich

hex digit

denote resp ectively the characters at p osition and at p o

sition in the character set current at the time of read

ing or writing The syntax for the external representation of

characters is dened in Table A

character character Acharacter



NOTE This text refers to the currentcharacter set but de

nes no means of selecting alternativecharacter sets This is to

allow for future extensions and implementationdened extensions

A Result

which supp ort more than one character set

If character is the same character as character the result



is character otherwise the result is

A character class

A binary method

The class of all characters

A Sp ecialized Arguments

A characterp function

character character Acharacter

A Arguments

character character Acharacter



object Ob ject to examine

A Result

A Result

If b oth characters denote upp ercase alphab etic or b oth de

Returns object if it is a character otherwise

note lowercase alphab etic the result is dened by alpha

b etical order If b oth characters denote a digit the result

is dened bynumerical order In these three cases if the

comparison is true the result is character otherwise it is

A equal method

Any other comparison is an error and the result of such

comparisons is undened

A Sp ecialized Arguments

A Examples character character Acharacter

Programming Language EuLisp version

binary A Z  A

A Result

binar a z  a

If character denotes an lower case character a character de

binary 

noting its upp er case counterpart is returned Otherwise the

binary A a  undened

result is the argument

binary A  undened

binary a  undened

A genericprin method

A See also Metho d on binary A for strings

A

A Sp ecialized Arguments

character character Character to b e ouptut on

A aslowercase generic function

stream

stream stream Stream on which character is to b e

A Generic Arguments

ouptut

object object An ob ject to convert to lower case

A Result

A Result

The character character

An instance of the same class as object converted to lower

case according to the actions of the appropriate metho d for

A Remarks

the class of object

Output the interpretation of character on stream

A

See also Another metho d is dened on aslowercase for

A genericwrite method

strings A

A Sp ecialized Arguments

A aslowercase method

character character Character to b e ouptut on

stream

A Sp ecialized Arguments

stream stream Stream on which character is to b e

character character Acharacter

ouptut

A Result

A Result

If character denotes an upp er case character a character

The character character

denoting its lower case counterpart is returned Otherwise

the result is the argument

A Remarks

Output external representation of character on stream in the

A asuppercase generic function

format name as describ ed at the b eginning of this section

A Generic Arguments

object object An ob ject to convert to upp er case

A Result

An instance of the same class as object converted to upp er

case according to the actions of the appropriate metho d for

the class of object

A

See also Another metho d is dened on asuppercase for

strings A

A asuppercase method

A Sp ecialized Arguments

character character Acharacter

Programming Language EuLisp version

The result is the result of the applicatio n of function to A Collections

the accumulated result and successive elements of col lection

The initial value of the accumulated result is supplied by obj

The dened name of this mo dule is collectionAcol lec

tion is dened as an instance of one of list string

vector table or any userdened class for whicha

A Examples

metho d is added to any of the collection manipulati on func

Note that the order of the elements in the result of the second

tions Collection do es not name a class and do es not form a

example dep ends on the hashing algorithm of the implemen

part of the class hierarchy This mo dule denes a set of op er

tation and do es not prescrib e the result that any particular

ators on collections as generic functions and default metho ds

implementation must give

with the b ehaviours given here

accumulate 

When iterating over a single collection the order in whichel

accumulate  c b a

ements are pro cessed might not b e imp ortant but as so on as

lambda a v cons v a

more than one collection is involved it is necessary to sp ec

ify how the collections are aligned so that it is clear which

make table

elements of the collections will b e pro cessed together This

entries

is quite straightforward in the cases of list string

b a c

and vector since there is an intuitive natural order for

the elements which allows them to b e identied by a non

negativeinteger Thus when iterating over a combination

of any of these all the elements at index p osition i will b e

A accumulate generic function

pro cessed together starting with the elements at p osition

and nishing with those at p osition n  where n is the

A Generic Arguments

size of the smallest collection in the combination The sub

set of collections whichhave natural order is called sequence

function function A function of two arguments

tied by the predicate and memb ers of this set can b e iden

sequencep while collections in general can b e identied by

col lection object The collection which is the sub

collectionp

ject of the accumulation op eration

Collection alignment is more complicated when tables are in

volved since they use explicit keys rather than natural order

A Result

to identify their elements In any iteration over a combina

The result is the result of the applicatio n of function to

tion of collections including a table or some tables the set

the accumulated result and successive elements of col lection

of keys used is the intersection of the keys of the tables and

starting with the second element The initial value of the ac

the implicit keys of the other collection classes present this

cumulated result is the rst elementofcol lection The terms

identies the elements of the collections with common keys

rst and second corresp ond to the appropriate elements of

Thus for an iteration to pro cess any elements from the com

a natural order collection but no elements in particular of

bination of a collection with natural order and a table the

an explicit key collection If col lection is empty the result is

table must havesomeinteger keys and they must b e in the

range siz e of the collection with natural order

A conforming level implementation must dene metho ds

A Examples

on these functions to supp ort op erations on lists A

 accumulate

strings A tables A vector A and any com

lambda a v

bination of these

if evenp v cons v a a

A collectioncondition condition

A anyp generic function

This is the condition class for all collection pro cessing con

ditions

A Generic Arguments

function function A function to b e used as a pred

A accumulate generic function

icate on the elements of the collections

col lection object A collection

A Generic Arguments

morecol lections More collections

function function A function of two arguments

obj object The ob ject which is the initial value for

A Result

the accumulation op eration

The function is applied to argument lists constructed from

corresp onding successive elements of col lection and more

col lection object The collection which is the sub

col lections If the result is true the result of anyp is true

ject of the accumulation op eration

and there are no further applications of function to elements

of col lection and morecol lectionsIfany of the collections

is exhausted the result of any is A Result

Programming Language EuLisp version

A Examples

A do generic function

anyp even  true

anyp  true

lambda a b a b

A Generic Arguments

function function A function

A collectionp generic function

col lection object A collection

morecol lections More collections

A Generic Arguments

A Result

object object An ob ject to examine

The result is This op erator is used for sideeect only

The function is applied to argument lists constructed from

A Result

corresp onding successive elements of col lection and more

col lections and the result is discarded Application stops if

Returns true if object is a collection otherwise

any of the collections is exhausted

A Remarks

A Examples

This predicate do es not return object b ecause is a collec

do prin b c  bc

tion

do write b c  bc

A concatenate generic function

A element generic function

A Generic Arguments

A Generic Arguments

col lection object A collection

col lection object The ob ject to b e accessed or up

dated

morecol lections More collections

key object The ob ject identifying the key of the

elementincol lection

A Result

The result is an ob ject of the same class as col lection

A Result

The value asso ciated with key in col lection

A Remarks

The contents of the result ob ject dep end on whether col lec

tion has natural order or not

A Examples

element abc  b

a If col lection has natural order then the size of the

element a b c  b

result is the sum of the sizes of col lection and more

element a b c  b

col lections The result collection is initiali zed with the

element  b

elements of col lection followed by the elements of eachof

make table fillvalue b

morecol lections taken in turn If any element cannot b e

stored in the result collection for example if the result is

a string and some elementisnotacharacter an error is

signalled condition class collectioncondition

A setter element setter

b If col lection do es not have natural order then the

result will contain asso ciations for eachofthekeys in col

A Generic Arguments

lection and morecol lectionsIfanykey o ccurs more than

once the asso ciated value in the result is the value of the

col lection object The ob ject to b e accessed or up

last o ccurrence of that key after pro cessing col lection and

dated

eachofmorecol lections taken in turn

key object The ob ject identifying the key of the

elementincol lection

A Examples

concatenate bc  b c value object The ob ject to replace the value asso

concatenate a b  ab ciated with key in col lection for setter

concatenate 

table

make table

c

A Result

a b

b

The argument supplied as value having up dated the asso ci

c

ation of key in col lection to refer to value

Programming Language EuLisp version

A Result

The result is an ob ject of the same class as col lectionThe A emptyp generic function

elements of the result are computed by the application of

function to argument lists constructed from corresp onding

A Generic Arguments

successive elements of col lection and morecol lections Ap

plication stops if any of the collections is exhausted

col lection object The ob ject to b e examined

A Examples

A Result

map cons 

Returns true if col lection is the ob ject identied with the

map 

empty ob ject for that class of collection

lambda f f

A Examples

emptyp  true

A member generic function

emptyp  true

emptyp  true

emptyp make table  true

A Generic Arguments

object object The ob ject to b e searched for in col

lection

A fill generic function

col lection object The collection to b e searched

A Generic Arguments

test function The function to b e used to com

pare object and the elements of col lection

col lection object A collection to b e partially

lled

A Result

object object The ob ject with which to ll col lec

Returns true if there is an elementofcol lection such that the

tion

result of the application of test to object and that element

is true If test is not supplied eql is used by default Note

keys The keys with which object is to b e asso ciated

that true denotes anyvalue that is not and that the class

of the result dep ends on the class of col lection In particular

if col lection is a list the result of member is a list

A Result

The result is

A Examples

member b abc  true

A Remarks

member b a b c  b c

This function sideeects col lection by up dating the values

member b a b c  true

asso ciated with each of the sp ecied keys with objIfnokeys

member  true

are sp ecied the whole collection is lled with obj Other

b

wise the key sp ecication can taketwo forms

make table

entries

a A collection in which case the values of the collection

b a c

are taken to b e the keys of col lection to b e asso ciated with

obj

A reverse generic function

b Two xed precision integers denoting the start and

end keys resp ectively in a natural order collection to b e

asso ciated with obj An error is signalled condition class

A Generic Arguments

collectionconditionif col lection do es not have natu

ral order It is an error if the start and end do not sp ecify

col lection object A collection

al of the interval siz e where an ascending subinterv

size is that of col lection

A Result

The result is an ob ject of the same class as col lection whose

A map generic function

elements are the same as those in col lection but in the re

verse order with resp ect to the natural order of col lectionIf

col lection do es not have natural order the result is equal to

A Generic Arguments

the argument

function function A function

A Examples

col lection object A collection

reverse abc  cba

reverse 

morecol lections More collections

reverse a b c  c b a

Programming Language EuLisp version

A sequencep generic function A converter string method

A Sp ecialized Arguments

A Generic Arguments

col lection object A collection to b e converted into

object object An ob ject to examine

a string

A Result

A Result

Returns true if object is a sequence has natural order oth

If col lection is a string the result is the argument Other

erwise

wise a string is constructed and returned whose elements are

the elements of col lection as long as al l the elements of col

lection are characters An error is signalled condition class

A Remarks

conversionconditionifany elementofcol lection is not a

This predicate do es not return object b ecause is a se

character If col lection has natural order then the elements

quence

will app ear in the result in the same order as in col lection

If col lection do es not have natural order the order in the

resulting string is undened

A size generic function

A See also Conversion A

A Generic Arguments

A converter table method

col lection object The ob ject to b e examined

A Sp ecialized Arguments

A Result

col lection object A collection to b e converted into

An integer which denotes the size of col lection according to

a table

the metho d for the class of col lection

A Result

A Examples

If col lection is a table the result is the argument Other

size 

wise a table is constructed and returned whose elements are

size 

the elements of col lectionIfcol lection has natural order

size 

then the elements will b e stored under integer keys in the

size make table 

range size otherwise the keys used will b e the keys

size abc 

asso ciated with the elements of col lection

size cons 

size cons 

size cons cons 

A See also Conversion A

size 

size a b c 

size make table entries a 

A converter vector method

A Sp ecialized Arguments

A converter list method

col lection object A collection to b e converted into

A Sp ecialized Arguments

avector

col lection object A collection to b e converted into

A Result

a list

If col lection is a vector the result is the argument Otherwise

avector is constructed and returned whose elements are the

elements of col lectionIfcol lection has natural order then

A Result

the elements will app ear in the result in the same order as

If col lection is a list the result is the argument Otherwise

in col lectionIfcol lection do es not have natural order the

a list is constructed and returned whose elements are the

order in the resulting vector is undened

elements of col lectionIfcol lection has natural order then

the elements will app ear in the result in the same order as

in col lectionIfcol lection do es not have natural order the

A See also Conversion A

order in the resulting list is undened

A See also Conversion A

Programming Language EuLisp version

A Result A Comparison

If the class of object and of object is the same and is a



The dened name of this mo dule is compare There are four

sub class of number the result is that of comparing them

functions for comparing ob jects for equality of which is

under If the class of object and of object is the same and



sp ecically for comparing numeric values and eq eql and

is a sub class of character the result is that of comparing

equal are for all ob jects The latter three are related in the

them under equal Otherwise the result is that of comparing

following way

them under eq

eq ab  eql ab  equal ab

eq ab  eql ab  equal ab

A Examples

Given the same set of examples as for eq the same result is

There is one function for comparing ob jects by order which

obtained except in the following cases

is called and which is implemented by the generic function

binary A summary of the comparison functions and the

eql  t

classes for which they have dened b ehaviour is given in

eql  t

Table A

eql a a  t

A eq function

A equal generic function

A Arguments

A Arguments

object An ob ject

object An ob ject

object An ob ject



object An ob ject



A Result

A Result

Compares object and object and returns t if they are the



Returns true or false according to the metho d for the

same ob ject otherwise Same in this context means

classes of object and object It is an error if either or



identies the same memory lo cation

b oth of the arguments is selfreferential

A Remarks

A See also Class sp ecic metho ds on equal are de

In the case of numb ers and characters the b ehaviour of eq

ned for characters A lists A numb ers A

might dier b etween pro cessors b ecause of implementation

strings A and vectors A All other cases are han

choices ab out internal representations Therefore eq might

dled by the default metho d

return t or for numb ers which are and similarly for

characters which are eql dep ending on the implementation

A equal method

A Examples

eq a a  t

A Sp ecialized Arguments

eq a b 

eq  t or

object object An ob ject

eq 

eq  t or

object object An ob ject



eq cons a b cons a c 

eq cons a b cons a b 

or eq a b a b  t

A Result

let x cons a b eq x x  t

The result is as if eql had b een called with the arguments

let x a b eq x x  t

supplied

eq a a  t or

eq string string  t or

eq a b a b  t or

A Remarks

let x a b eq x x  t

Note that in the case of this metho d b eing invoked from

equal the arguments cannot b e charactersornumbers

A eql function

A function

A Arguments

A Arguments

object An ob ject

object An ob ject number A nonempty sequence of numbers



Programming Language EuLisp version

Table A Summary of comparison functions

eq objectobject

eql objectobject

charactercharacterequal

fixedprecisionintegerfixedprecisionintegerbinary

doublefloatdoublefloatbinary

equal objectobject

charactercharacter

nullnull

numbernumbereql

conscons

stringstring

vectorvector

numbernumberbinary

binary fixedprecisionintegerfixedprecisioninteger

doublefloatdoublefloat

objectobjectbinary

binary charactercharacter

fixedprecisionintegerfixedprecisioninteger

doublefloatdoublefloat

stringstring

A Result

A binary generic function

Given one argument the result is true Given more than one

argument the result is determined by binary returning true

if all the arguments are the same otherwise

A Generic Arguments

object object An ob ject

A binary generic function

object object An ob ject



A Generic Arguments

A Result

number number Anumb er

The rst argument if it is less than the second according to

number number Anumb er



the metho d for the class of the arguments otherwise

A Result

A See also Class sp ecic metho ds on binary are

One of the arguments or

dened for characters A strings A xed precision

integers A and double oats A

A Remarks

The result is either a number or This is determined by

A max function

whichever class sp ecic metho d is most applicabl e for the

supplied arguments

A Arguments

A See also Class sp ecic metho ds on binary are de

object A nonempty sequence of ob jects

ned for xed precision integer A and double oat A

A Result

A function

The maximal element of the sequence of ob jects object up to

object using the generic function binaryZeroarguments

n

A Arguments

is an error One argument returns object

object A nonempty sequence of ob jects

A min function

A Result

Given one argument the result is true Given more than one

A Arguments

argument the result is true if the sequence of ob jects object

up to object is strictly increasing according to the generic

n

object A nonempty sequence of ob jects

function binary Otherwise the result is

Programming Language EuLisp version

A Result A Conversion

The minimal element of the sequence of ob jects object up to

The dened name of this mo dule is convert

object using the generic function binary Zero arguments

n

is an error One argument returns object

The mechanism for the conversion of an instance of one class

to an instance of another is dened by a userextensible

framework which has some similarity to the setter mech

anism

To the user the interface to conversion is via the function

convert whichtakes an ob ject and some class to whichthe

ob ject is to b e converted The target class is used to access

an asso ciated converter function in fact a generic function

which is applied to the source instance dispatching on its

class to select the metho d which implements the appropriate

conversion Thus having dened a new class to whichit

may b e desirable to convert instances of other classes the

programmer denes a generic function

defgeneric converter newclass instance

Hereafter new converter metho ds may b e dened for new

class using a similar extended syntax for defmethod

defmethod converter newclass

instance otherclass

The conversion is implemented by dening metho ds on the

converter for newclass which sp ecialize on the source class

This is also how metho ds are do cumented in this text by

an entry for a metho d on the converter function for the tar

get class In general the metho d for a given source class

is dened in the section ab out that class for example con

verters from one kind of collection to another are dened in

section A converters from string in section A etc

A convert function

A Arguments

object An instance of some class to b e converted to an

instance of class

class The class to which object is to b e converted

A Result

Returns an instance of class whichisequivalentinsome

classsp ecic sense to object whichmaybeaninstanceof

anytyp e Calls the converter function asso ciated with class

to carry out the conversion op eration An error is signalled

condition noconverter if there is no asso ciated function

An error is signalled condition noapplicablemethodif

there is no metho d to convert an instance of the class of

object to an instance of class

A conversioncondition condition

This is the general condition class for all conditions arising

from conversion op erations

Programming Language EuLisp version

A Initializatio n Options A Copying

source object The ob ject to b e converted into an

The dened name of this mo dule is copy

instance of targetclass

targetclass class The target class for the conver

A deepcopy generic function

sion op eration

A Generic Arguments

A Remarks

Should b e signalled by convert oraconverter metho d

object An ob ject to b e copied

A converter function A Result

Constructs and returns a copy of the source which is the same

under some class sp ecic predicate as the source and whose

A Arguments

slots contain copies of the ob jects stored in the corresp onding

slots of the source and so on The exact b ehaviour for each

targetclass The class whose set of conversion metho ds

class of object is dened by the most applicabl e metho d for

is required

object

A Result

A See also Class sp ecic sections which dene meth

The accessor returns the converter function for the class

ods on deepcopy list A string A table A

targetclass The converter is a genericfunction with meth

and vector A

o ds sp ecialized on the class of the ob ject to b e converted

A deepcopy method

A setter converter setter

A Sp ecialized Arguments

A Arguments

object object An ob ject

targetclass The class whose converter function is to b e

replaced

A Result

genericfunction The new converter function

Returns object

A Result

The new converter function The setter function replaces

A deepcopy method

the converter function for the class targetclass by generic

function The new converter function must b e an instance

of genericfunction

A Sp ecialized Arguments

struct structureclass A structure

A Remarks

Converter metho ds from one class to another are dened in

the section p ertaining to the source class

A Result

Constructs and returns a new structure whose slots are ini

tialized with copies using deepcopy of the contents of the

A See also Converter metho ds are dened for collec

slots of struct

tions double oat A xed precision integer A

string A symb ol A vector A

A shallowcopy generic function

A Generic Arguments

object An ob ject to b e copied

A Result

Constructs and returns a copy of the source which is the

same under some class sp ecic predicate as the source The

exact b ehaviour for each class of object is dened by the most

applicable metho d for object

Programming Language EuLisp version

A See also Class sp ecic sections which dene meth A Double Precision Floats

ods on shallowcopy pair A string A ta

ble A and vector A

The dened name of this mo dule is double Arithmetic op

erations for doublefloat are dened by metho ds on the

generic functions dened in the numb er mo dule A

A shallowcopy method

binary binary binary binary binary binary

mod negate zerop

A Sp ecialized Arguments

the oat mo dule A

object object An ob ject

ceiling floor round truncate

A Result

and the elementary functions mo dule A

Returns object

acos asin atan atan cos sin tan cosh sinh tanh

exp log log pow sqrt

A shallowcopy method

The b ehaviour of these functions is dened in the mo dules

noted ab ove

A Sp ecialized Arguments

A doublefloat class

struct structureclass A structure

The class of all double precision oating p ointnumbers

A Result

Constructs and returns a new structure whose slots are ini

The syntax for the exp onent of a double precision oating

tialized with the contents of the correpsonding slots of struct

pointisgiven b elow The general syntax for oating p oint

numb ers is given in section A

double exponent

d D sign decimal integer A

A doublefloatp function

A Arguments

object Ob ject to examine

A Result

Returns object if it is a double oat otherwise

A See also floatp A

A mostpositivedoublefloat doubleoat

A Remarks

The value of mostpositivedoublefloat is that p ositive

double precision oating p ointnumb er closest in value to

but not equal to p ositive innity that the pro cessor pro

vides

A leastpositivedoublefloat doubleoat

A Remarks

The value of leastpositivedoublefloat is that p ositive

Programming Language EuLisp version

A Remarks double precision oating p ointnumb er closest in value to

but not equal to zero that the pro cessor provides

This function is the same as round It is dened for the sake

of symmetry

A leastnegativedoublefloat doubleoat

A genericprin method

A Remarks

A Sp ecialized Arguments

The value of leastnegativedoublefloat is that negative

double precision oating p ointnumb er closest in value to

double doublefloat The double oat to b e out

but not equal to zero that the pro cessor provides Even if

put on stream

the pro cessor provide negative zero this value must not b e

negative zero

stream stream The stream on which the represen

tation is to b e output

A mostnegativedoublefloat doubleoat

A Result

The double oat supplied as the rst argument

A Remarks

The value of mostnegativedoublefloat is that negative

A Remarks

double precision oating p ointnumb er closest in value to

Outputs the external representation of double on streamas

but not equal to negative innity that the pro cessor pro

an optional sign preceding the syntax dened by oat for

vides

mat Finer control over the format of the output of oating

p ointnumb ers is provided by some of the formatting sp eci

cations of format see section A

A equal method

A Sp ecialized Arguments

A genericwrite method

double doublefloat A double precision oat

A Sp ecialized Arguments

double doublefloat A double precision oat



double doublefloat The double oat to b e out

put on stream

A Result

stream stream The stream on which the represen

The result of calling binary on double and double



tation is to b e output

A Result

A converter string method

The double oat supplied as the rst argument

A Sp ecialized Arguments

A Remarks

Outputs the external representation of double on streamas

x doublefloat A double precision oat

an optional sign preceding the syntax dened by oat for

mat Finer control over the format of the output of oating

p ointnumb ers is provided by some of the formatting sp eci

A Result

cations of format see section A

Constructs and returns a string the characters of which

corresp ond to the external representation of x as pro duced

by genericprin namely that sp ecied in the syntax as

signoat format

A converter fixedprecisioninteger method

A Sp ecialized Arguments

x doublefloat A double precision oat

A Result

A xed precision integer

Programming Language EuLisp version

oat float A oating p ointnumber A Elementary Functions



The dened name of this mo dule is elementaryfunctions

A Result

The functionality dened for this mo dule is intentionally

precisely that of the trigonmetric functions hyp erb olic func

Computes the principal value of the arc tangent of

tions exp onential and logarithmic functions and p ower func

oat oat whichisavalue in the range  radians



tions dened for mathh in ISOIEC with the

using the signs of b oth arguments to determine the quadrant

exceptions of frexp ldexp and modf

of the result An error might b e signalled conditioncl ass

domaincondition if either oat or oat is zero



A pi doubleoat

A cos generic function

A Remarks

A Generic Arguments

The value of pi is the ratio the circumference of a circle to its

diameter stored to double precision oating p oint accuracy

oat float A oating p ointnumb er

A acos generic function

A Result

Computes the cosine of oat measured in radians

A Generic Arguments

oat float A oating p ointnumb er

A sin generic function

A Result

A Generic Arguments

Computes the principal value of the arc cosine of oat which

oat float A oating p ointnumb er

is a value in the range radians An error is signalled

conditionclass domainconditionif oat is not in the

range 

A Result

Computes the sine of oat measured in radians

A asin generic function

A tan generic function

A Generic Arguments

A Generic Arguments

oat float A oating p ointnumb er

oat float A oating p ointnumb er

A Result

Computes the principal value of the arc sine of oat which

A Result

is a value in the range  radians An error is

Computes the tangentofoat measured in radians

signalled conditionclas s domainconditionif oat is not

in the range 

A cosh generic function

A atan generic function

A Generic Arguments

A Generic Arguments

oat float A oating p ointnumb er

oat float A oating p ointnumb er

A Result

A Result

Computes the hyp erb olic cosine of oat An error mightbe

signalled condition class rangecondition if the magni

Computes the principal value of the arc tangentofoat

tude of oat is to o large

which isavalue in the range  radians

A sinh generic function

A atan generic function

A Generic Arguments

A Generic Arguments

oat float A oating p ointnumb er

oat float A oating p ointnumb er

Programming Language EuLisp version

oat float A oating p ointnumber A Result

Computes the hyp erb olic sine of oat An error might b e sig

oat float A oating p ointnumber



nalled condition class rangecondition if the magnitude

of oat is to o large

A Result

Computes oat raised to the p ower oat An error is sig



A tanh generic function

nalled condition class domainconditionif oat is nega

tive and oat is not integral An error is signalled condition



class domaincondition if the result cannot b e represented

A Generic Arguments

when oat is zero and oat is less than or equal to zero An



error might b e signalled condition class rangecondition

oat float A oating p ointnumber

if the result cannot b e represented

A Result

A sqrt generic function

Computes the hyp erb olic tangentofoat

A Generic Arguments

A exp generic function

oat float A oating p ointnumber

A Generic Arguments

A Result

oat float A oating p ointnumber

Computes the nonnegative square ro ot of oat An error

is signalled condition class domainconditionif oat is

negative

A Result

Computes the exp onential function of oat An error might

b e signalled condition class rangecondition if the mag

nitude of oat is to o large

A log generic function

A Generic Arguments

oat float A oating p ointnumber

A Result

Computes the natural logarithm of oat An error is

signalled condition class domainconditionif oat is

negative An error might b e signalled condition class

rangeconditionif oat is zero

A log generic function

A Generic Arguments

oat float A oating p ointnumber

A Result

Computes the baseten logarithm of oat An error is

signalled condition class domainconditionif oat is

negative An error might b e signalled condition class

rangeconditionif oat is zero

A pow generic function

A Generic Arguments

Programming Language EuLisp version

A Result A Floating Point Numb ers

Returns object if it is a oating p ointnumb er otherwise

The dened name of this mo dule is float This mo dule de

nes the abstract class float and the b ehaviour of some

generic functions on oating p ointnumbers Further op era

A ceiling generic function

tions on numb ers are dened in the numb ers mo dule A

and further op erations on oating p ointnumb ers are dened

in the elementary functions mo dule A A concrete oat

A Generic Arguments

class is dened in the double oat mo dule A

oat float A oating p ointnumb er

A float syntax

A Result

Returns the smallest integral value not less than oat ex

pressed as a oat of the same class as the argument

The syntax for the external representation of oating p oint

literals is dened in Table A The representation used by

write and prin is that of a sign a whole part and a fractional

part without an exp onent namely that dened by oat for

A floor generic function

mat Finer control over the format of the output of oating

pointnumb ers is provided by some of the formatting sp eci

A Generic Arguments

cations of format section A

oat float A oating p ointnumb er

Table A Floating Point Syntax

A Result

float

Returns the largest integral value not greater than oat ex

signunsigned float exponent

pressed as a oat of the same class as the argument

sign

unsigned float

float format

A round generic function

float format

float format

float format

A Arguments

decimal integer A

float format

oat A oating p ointnumber

decimal integer A

float format

float format decimal integer A

A Result

exponent

Returns the integer whose value is closest to oat except in

double exponent A

the case when oat is exactly halfwaybetween twointegers

when it is rounded to the one that is even

A oating p ointnumb er has six forms of external represen

tation dep ending on whether either or b oth the whole and

A truncate generic function

the fractional part are sp ecied and on whether an exp onent

is sp ecied In addition a p ositive oating p ointnumber

is optionally preceded by a plus sign and a negative oat

A Arguments

ing p ointnumb er is preceded byaminus sign For example

oat format oat format oat

oat A oating p ointnumber

format and with exp onents D D

D

A Result

Returns the greatest integer value whose magnitude is less

than or equal to oat

A float class

The abstract class which is the sup erclass of all oating p oint

numb ers

A floatp function

A Arguments

objext Ob ject to examine

Programming Language EuLisp version

integer fixedprecisioninteger A xed preci A Fixed Precision Integers

sion integer

The dened name of this mo dule is fpi Arithmetic op era

tions for fixedprecisionintegerare dened by meth

integer fixedprecisioninteger A xed preci



o ds on the generic functions dened in the numb er mo dule

sion integer

binary binary binary binary binary binary

binary binarygcd binarylcm mod negate zerop

A Result

The result of calling binary on integer and integer



and in the integer mo dule

evenp

A Remarks

The dierence b etween equal and is that the former only

The b ehaviour of these functions is dened in the mo dules

compares numb ers of the same class whereas the latter co noted ab ove

erces the numb ers to b e of the same class b efore comparison

A fixedprecisioninteger class

A converter string method

The class of all instances of xed precision integers

A Sp ecialized Arguments

A fpi class

integer fixedprecisioninteger An integer

A Remarks

A Result

A constant binding whose value is

Constructs and returns a string the characters of whichcor

fixedprecisioninteger

resp ond to the external representation of integer in decimal

notation

A fixedprecisionintegerp function

A converter doublefloat method

A Arguments

A Sp ecialized Arguments

object Ob ject to examine

integer fixedprecisioninteger An integer

A Result

Returns object if it is xed precision integer otherwise

A Result

Returns a double oat whose value is the oating p ointap

proximation to integer

A mostpositivefixedprecisioninteger

xedprecisioninteger

A genericprin method

A Remarks

This is an implementationd ened constant A conform

ing pro cessor must supp ort a value greater than or equal

A Sp ecialized Arguments

to and greater than or equal to the value of

maximumvectorindex

integer fixedprecisioninteger An integer to

b e output on stream

A mostnegativefixedprecisioninteger

stream stream The stream on which the represen

xedprecisioninteger

tation is to b e output

A Remarks

A Result

This is an implementationde ned constant A conforming

The xed precision integer supplied as the rst argument

pro cessor must supp ort a value less than or equal to 

A Remarks

A equal method

Outputs external representation of integer on stream in dec

imal as dened by decimal integer at the b eginning of this

A Sp ecialized Arguments section

Programming Language EuLisp version

A FormattedIO

A genericwrite method

The dened name of this mo dule is formattedio

A Sp ecialized Arguments

A scan function

integer fixedprecisioninteger An integer to

b e output on stream

A Arguments

stream stream The stream on which the represen

formatstring A string containing format directives

tation is to b e output

stream A stream from which input is to b e taken

A Result

The xed precision integer supplied as the rst argument

A Result

Returns a list of the ob jects read from stream

A Remarks

Outputs external representation of integer on stream in dec

A Remarks

imal as dened by decimal integer at the b eginning of this

section This function provides supp ort for formatted input The

formatstring sp ecies reading directives and inputs are

matched according to these directives An error is signaled

condition scanmismatch if the class of the ob ject read

is not compatible with the sp ecied directive The second

optional argument sp ecies a stream from whichtotake

input If stream is not supplied input is taken from the re

sult of calling standardinputstream Scan returns a list

of the ob jects read in

a any any ob ject

b binary an integer in binary format

c character a single character

d decimal an integer decimal format

n e a exp onentialformat oatingp oint number

n f a xedformat oatingp oint number

o o ctal an integer in o ctal format

r radix an integer in sp ecied radix format

x hexadecimal an integer in hexadecimal format

newline matches a newline character in the

input

A scanmismatch streamcondition

A Initializati on Options

formatstring string The value of this option is the

format string that was passed to scan

input list The value of this option is a list of the items

read by scan up to and includi ng the ob ject that caused

the condition to b e signaled

A Remarks

This condition is signalled by scan if the format string do es

not match the data input from stream

Programming Language EuLisp version

nr radix the argumentmustbeaninteger and is

output in radix n notation Table A

A format function

s sexpression uses write to output the argument

Table

A Arguments

n t tab output sucient spaces to reach the next

stream One of t or a stream

th

tabstop if n is not sp ecied or the n tab stop if it is

formatstring A string containing format directives

x hexadecimal the argumentmustbeaninteger

and is output in hexadecimal notation Table A

object A sequence of ob jects to b e output on

stream

newline output a newline character using

newline

A Result

conditional newline output a newline char

Returns a list comprising those ob jects left in the sequence

acter using newline if it cannot b e determined that the

after the last format directivewas pro cessed

output stream is at the b eginning of a fresh line

tilde output a tilde character using prin

A Remarks

Has sideeect of outputting object s according the formats

sp ecied in formatstringIfstream is t the output is to

the current output stream If stream is a formatted

string is returned as the result of the call Otherwise stream

must b e a valid output stream Characters are output as

if the string were output by the prin function with the ex

ception of those prexed by tilde graphic representation

which are treated sp ecially as detailed in the following

list These formatting directives are intentionally compat

ible with the facilities dened for the function fprintf in

ISOIEC

a any uses prin to output the argument

b binary the argumentmust b e an integer and is

output in binary notation Table A

c character the argumentmust b e a character and

is output using write Table A

d decimal the argumentmustbeaninteger and is

output using write Table A

m n e exp onentialformat oatingp oint the

argumentmust b e a oating p ointnumb er It is output in

the style ddddedd in a eld of width m characters

where there are n precision digits after the decimal p oint

or digits if n is not sp ecied Table A If the value

to b e output has fewer characters than m it is padded on

the left with spaces

m n f xedformat oatingp oint the argu

mentmust b e a oating p ointnumb er It is output in the

style dddddd in a eld of width m characters where

the are n precision digits after the decimal p oint or dig

alue is rounded its if n is not sp ecied Table A The v

to the appropriate numb er of digits If the value to b e

output has fewer characters than m it is padded on the

left with spaces

m n g generalized oatingp oint the argument

must b e a oating p ointnumb er It is output in either

xedformat or exp onential notation as appropriate Ta

ble A

o o ctal the argumentmust b e an integer and is

output in o ctal notation Table A

Programming Language EuLisp version

Table A Integer Syntax

A Integers

mo dule The dened name of this mo dule is integer This

mo dule denes the abstract class integer and the b e integer

signunsigned integer

haviour of some generic functions on integers Further op era

sign

tions on numb ers are dened in the numb ers mo dule A

A concrete integer class is dened in the xed precision in

unsigned integer

teger mo dule A

binary integer

octal integer

decimal integer

hexadecimal integer

A integer syntax

specified base integer

binary integer

b binary digit binary digit

A p ositiveinteger is has its external representation as a se

binary digit

quence of digits optionally preceded by a plus sign A nega

tiveinteger is written as a sequence of digits preceded bya

octal integer

minus sign For example

o octal digit octal digit

octal digit

Integer literals have an external representation in any base

up to base For convenience base base and base decimal integer

decimal digit decimal digit

have distinguis hed notationsb o and x resp ectively

hexadecimal integer

For example b o and xd all

x hexadecimal digit hexadecimal digit

denote the same value

hexadecimal digit

decimal digit

The general notation for an arbitrary base is base r where

hex lower letter

base is an unsigned decimal numb er Thus the ab ove ex

hex upper letter

amples may also b e written r r

hex lower letter

r rd or rya The reading of anynumber

a b c d e f

is terminated on encountering a character which cannot b e hex upper letter

A B C D E F

a constituent of that numb er The syntax for the external

specified base integer

representation of integer literals is dened in Table A

base specification r

specified base digit

NOTE At present this text do es not dene a class integer

specified base digit

with variable precision It is planned this should app ear in a fu

base specification

ture version at level of the language The class will b e named

decimal digit

variableprecisioninteger The syntax given here is appli

decimal digit

cable to b oth xed and variable precision integers

specified base digit

decimal digit letter

A integer class

The abstract class which is the sup erclass of all integer num

b ers

A oddp function

A integerp function

A Arguments

integer An integer

A Arguments

object Ob ject to examine

A Result

Returns the equivalent of the logical negation of evenp ap

A Result

plied to integer

Returns object if it is an integer otherwise

A evenp generic function

A Arguments

integer integer An integer

A Result

Returns t if two divides integer otherwise

Programming Language EuLisp version

A Result A Lists

The empty list

The name of this mo dule is list The class list is an ab

stract class and has two sub classes null and cons The

only instance of null is the empty list The combination

A Remarks

of these two classes allows the creation of prop er lists since

Output the external representation of the empty list on

a prop er list is one whose last pair contains the empty list

stream as describ ed ab ove

in its cdr eld See also section A collections for further

op erations on lists

A pair syntax

A syntax

A pair is written as object object where object is called



A Remarks

the car and object is called the cdr There are two sp ecial



cases in the external representation of pair If object is the



The empty list which is the only instance of the class null

empty list then the pair is written as object Ifobject



has as its external representation an op en parenthesis fol

is an instance of pair then the pair is written as object

lowed by a close parenthesis The empty list is also used to

object object where object is the car of object and

   

denote the b o olean value false

object is the cdr with the ab ove rule for the emptylistap



plying By induction a list of length n is written as object

object object with the ab ove rule for the empty

n n

A null class

The representations of object and object list applying



are determined by the external representations dened in

other sections of this denition see character A

The class whose only instance is the empty list denoted

doublefloat A fixedprecisioninteger A

string A symbol A and vector A as

well as instances of cons itself The syntax for the external

A null function

representation of pairs and lists is dened in Table A

A Arguments

Table A Pair and List Syntax

object Ob ject to examine

null

A Result

pair

Returns t if object is the empty list otherwise

object object

list

empty list proper list improper list

empty list

A genericprin method

proper list

object

A Sp ecialized Arguments

improper list

object object

nul l The empty list

stream The stream on which the representation is to

b e output

A Examples

the emptylist

A Result

a list whose car is and cdr is

The empty list

a pair whose car is and cdr is

a list whose car is and cdr is

A Remarks

Output the external representation of the empty list on

stream as describ ed ab ove

A cons class

The class of all instances of cons An instance of the class

A genericwrite method

cons also known informally as a dottedpair or a pair is

a tuple whose slots are called for historical reasons car

A Sp ecialized Arguments

and cdrPairs are created by the function cons and the slots

are accessed by the functions car and cdr The ma jor use of

nul l The empty list

pairs is in the construction of prop er lists A prop er list

is dened as either the empty list denoted by orapair

stream The stream on which the representation is to

whose cdr is a prop er list An improp er list is one containing

b e output

a cdr which is not a list see Table A

Programming Language EuLisp version

It is an error to apply car or cdr or their setter functions

to anything other than a pair The empty list is not a pair

A setter car setter

and car or cdr is an error

A Arguments

A consp function

pair A pair

object An ob ject

A Arguments

object Ob ject to examine

A Result

Given a pair such as the result of cons object object



A Result

then the function setter car replaces object with object

The result is object

Returns object if it is a pair otherwise

A setter cdr setter

A atom function

A Arguments

A Arguments

pair A pair

object Ob ject to examine

object An ob ject

A Result

Returns object if it is not a pair otherwise

A Result

Given a pair such as the result of cons object object



then the function setter cdr replaces object with object



A cons function

The result is object

A Arguments

A Remarks

Note that if object is not a prop er list then the use of

object An ob ject pair

setter cdr mightchange pair into an improp er list

object An ob ject pair



A equal method

A Result

Allo cates a new pair whose slots are initialize d with object

A Sp ecialized Arguments

in the car and object in the cdr



pair A pair

A car function

pair A pair



A Arguments

A Result

The result is the conjunction of the pairwise application of

pair A pair

equal to the car elds and the cdr elds of the arguments

A Result

Given a pair such as the result of cons object object



A deepcopy method

then the function car returns object

A Sp ecialized Arguments

A cdr function

pair cons A pair

A Arguments

A Result

pair A pair

Constructs and returns a copy of the list starting at pair

copying b oth the car and the cdr slots of the list The list

can b e prop er or improp er Treatment of the ob jects stored

A Result

in the car slot and the cdr slot in the case of the nal pair

Given a pair such as the result of cons object object of an improp er list is determined bythedeepcopy metho d



then the function cdr returns object for the class of the ob ject



Programming Language EuLisp version

A Result

A shallowcopy method

The pair supplied as the rst argument

A Sp ecialized Arguments

A Remarks

Output the external representation of pair on stream as de

pair cons A pair

scrib ed at the b eginning of this section Uses genericwrite

to pro duce the external representation of the contents of the

car and cdr slots of pair

A Result

Constructs and returns a copy of the list starting at pair but

copying only the cdr slots of the list terminating when a

pair is encountered whose cdr slot is not a pair The list

b eginning at pair can b e prop er or improp er

A list function

A Arguments

object object A sequence of ob jects

n

A Result

Allo cates a set of pairs eachofwhich has b een initiali zed

with object in the car eld and the pair whose car eld

i

contains object in the cdr eld Returns the pair whose

i

car eld contains object

A Examples

list 

list 

A genericprin method

A Sp ecialized Arguments

pair cons The pair to b e output on stream

stream stream The stream on which the represen

tation is to b e output

A Result

The pair supplied as the rst argument

A Remarks

Output the external representation of pair on stream as de

scrib ed at the b eginning of this section Uses genericprin

to pro duce the external representation of the contents of the

car and cdr slots of pair

A genericwrite method

A Sp ecialized Arguments

pair cons The pair to b e output on stream

stream stream The stream on which the represen

tation is to b e output

Programming Language EuLisp version

operandlist list The op erands passed to the op erator A Numb ers

The dened name of this mo dule is number Numb ers can

A Remarks

takeonmany forms with unusual prop erties sp ecialized for

This is the general condition class for conditions arising from

dierent tasks but two classes of numb er suce for the

arithmetic op erations

ma jority of needs namely integers A A and oat

ing p ointnumb ers A A Thus these only are dened

at level

A divisionbyzero arithmeticcondition

In Figure A shows the initial numb er class hierar

chyatlevel The inheritance relationships by this

Signalled byanyofbinary binary and binarymod if

diagram are part of this denition but it is not de

their second argument is zero

ned whether they are direct or not For example

integer and float are not necessarily direct sub

classes of number while the class of eachnumb er class

might b e a sub class of numberclass Since there are

A function

only two concrete numb er classes at level co ercion

is simple namely from fixedprecisioninteger to

A Arguments

doublefloatAnylevel version of a library mo dule for

example elementaryfunctions need only dene metho ds

number number A sequence of numbers



for these two classes Mathematicall y the reals are regarded

as a sup erset of the integers and for the purp oses of this def

integer even inition we regard float as a sup erset of

A Result

though this will cause representation problems when vari

Computes the sum of the arguments using the generic func

able precision integers are intro duced Hence float is

tion binary Given zero arguments returns of class

referred to as b eing higher that integer and arithmetic

integer One argument returns that argument The ar

involving instances of b oth classes will cause integers to b e

guments are combined leftasso ciativel y

converted to an equivalent oating p ointvalue b efore the



calculation pro ceeds see in particular binary binary

and binarymod

A function

Figure A Level numb er class hierarchy

A Arguments

number numberclass

float numberclass

number number A nonempty sequence of num



doublefloat numberclass

b ers

integer numberclass

fixedprecisioninteger numberclass

A Result

Computes the result of subtracting successive arguments

from the second to the lastfrom the rst using the generic

A number class

function binary Zero arguments is an error One argument

returns the negation of the argument using the generic func

The abstract class which is the sup erclass of all number

tion negate The arguments are combined leftasso ciatively

classes

A function

A numberp function

A Arguments

A Arguments

number number A sequence of numbers



object Ob ject to examine

A Result

A Result

Computes the pro duct of the arguments using the generic

Returns object if it is a numb er otherwise

function binaryGiven zero arguments returns of class

integer One argument returns that argument The argu

ments are combined leftasso ciatively

A arithmeticcondition condition

A function

A Initializati on Options

operator object The op erator which signalled the con

A Arguments

dition



number number A nonempty sequence of num

This b ehaviour is p opularly referred to as oating point



contagion

b ers

Programming Language EuLisp version

A Result

A zerop generic function

Computes the result of dividing the rst argumentby its suc

ceeding arguments using the generic function binary Zero

arguments is an error One argument computes the recip

A Generic Arguments

ro cal of the argument It is an error in the single argument

case if the argument is zero

number Anumber

A function

A Result

Compares number with the zero element of the class of num

ber using the generic function binary

A Arguments

number number A nonempty sequence of num



b ers

A negate generic function

A Result

A Generic Arguments

Computes the result of taking the remainder of dividing the

number number Anumber

rst argumentby its succeeding arguments using the generic

function binary Zero arguments is an error One argument

returns that argument

A Result

Computes the additiveinverse of number

A gcd function

A signum function

A Arguments

number number A nonempty sequence of num

A Arguments



b ers

number Anumber

A Result

A Result

Computes the greatest common divisor of number up to

number using the generic function binarygcd Zero argu

n Returns number if zerop applied to number is true Oth

ments is an error One argumentreturnsnumber

erwise returns the result of converting  to the class of

number with the sign of number

A lcm function

A positivep function

A Arguments

A Arguments

number number A nonempty sequence of num



b ers

number Anumber

A Result

A Result

Computes the least common multiple of number up to

Compares number against the zero element of the class of

number using the generic function binarylcm Zero ar

number using the generic function binary

n

guments is an error One argument returns number

A negativep function

A abs function

A Arguments

A Arguments

number Anumber

number Anumb er

A Result

A Result

Compares number against the zero element of the class of

Computes the absolute value of number number using the generic function binary

Programming Language EuLisp version

number number Anumb er

A binary generic function

number number Anumb er



A Generic Arguments

A Result

number number Anumber

Computes the value of number inumber expressed as a



numb er of the class of the higher of the classes of the two

number number Anumber arguments for some integer i such that if number is non

 

zero the result has the same sign as number and magnitude

less then the magnitude of number If the second argument



A Result

is zero the result might b e zero or an error might b e signalled

condition class divisionbyzero

Computes the sum of number and number



A binarymod generic function

A binary generic function

A Generic Arguments

A Generic Arguments

number number Anumb er

number number Anumber

number number Anumb er



number number Anumber



A Result

A Result

Computes the largest integral value not greater than

Computes the dierence of number and number



number number expressed as a numb er of the class of the



higher of the classes of the two arguments suchthatif

number is nonzero the result has the same sign as number

 

A binary generic function

and magnitude less than number If the second argumentis



zero the result might b e zero or an error might b e signalled

condition class divisionbyzero

A Generic Arguments

number number Anumber

A binarygcd generic function

number number Anumber



A Generic Arguments

A Result

number number Anumb er

Computes the pro duct of number and number



number number Anumb er



A binary generic function

A Result

Computes the greatest common divisor of number and

A Generic Arguments

number



number number Anumber

A binarylcm generic function

number number Anumber



A Generic Arguments

A Result

Computes the division of number by number expressed as



number number Anumb er

anumb er of the class of the higher of the classes of the two

arguments The sign of the result is p ositive if the signs the

number number Anumb er



arguments are the same If the signs are dierent the sign

of the result is negative If the second argument is zero the

result might b e zero or an error might b e signalled condition

A Result

class divisionbyzero

Computes the lowest common multiple of number and

number



A binary generic function

A Generic Arguments

Programming Language EuLisp version

A Streams

A charfilestream class

The dened name of this mo dule is stream

The class of the default character le stream Often instances

Level streams only oer the most basic functional

of this stream typ e are p ositionable It is an error to make

ity supp orting character input and output on les via

an instance of this class byany other means than by the use

charfilestream and character input and output on

of open

strings via stringstream This functionality is imple

mented by the two generic functions input and output

A See also input output metho ds on

The b ehaviour at endofstream is governed by an option to

charfilestream

open This option takes a eosaction whichisacontinua

tion or some function of one argument as its value Up on

attempting to read b eyond the end of stream the value of

A stringstream class

the streams eosaction is called with the stream as its argu

ment and the result of the call of eosaction is returned as

the value of the input op eration This allows sp ecial actions

The class of the default string stream

to b e p erformed sp ecial values to b e returned or transfers

of control via continuations The default action is signal an

error condition class endofstream

A See also The converter metho d A for

stringstream to string

A stream class

A standardinputstream function

The abstract class of streams

This function takes no arguments

A streamp generic function

A Result

A stream which is the standard input stream

A Generic Arguments

A Remarks

object object The ob ject to b e examined

This stream is often the default for input functions

A Result

A standardoutputstream function

Returns object if it is a stream otherwise

This function takes no arguments

A filestreamp generic function

A Result

A stream which is the standard output stream

A Generic Arguments

A Remarks

object object The ob ject to b e examined

This stream is often the default for output functions

A Result

A standarderrorstream function

Returns object if it is a stream held on some external

medium otherwise

This function takes no arguments

A characterstreamp generic function

A Result

A stream which is the standard error stream

A Generic Arguments

object object The ob ject to b e examined

A open function

A Arguments

A Result

Returns object if it is a character stream otherwise name A string

Programming Language EuLisp version

A Remarks options A sequence of options

Closes the stream It is an error to try to output to or input

from a closed stream

A Result

A stream

A flush generic function

A Remarks

A Generic Arguments

Options are input output update append and

eosaction

stream stream A stream

If no options are sp ecied input is assumed and

the eosaction will signal an error condition class

A Result

endofstream

Returns t if the ush op eration was successful otherwise

The eosaction option takes a stream action a continua

tion or a function of one argument as an argument Up on

an attempt to read b eyond the end of the stream this stream

A Remarks

action is called with the stream as argument and the value

flush causes any buered data for the stream to b e written

returned by the stream action is the value returned by the

to the stream The stream remains op en

reading op eration If the eosaction is omitted the de

fault stream action is to signal an error condition class

endofstream

A streamposition generic function

It is an error to combine the input option with output

update or append It is an error to combine the output

A Generic Arguments

option with input

stream stream A stream

A Examples

open foo Op en the le foo for

A Result

input

Returns a nonnegativeinteger indicating the current p osi

for output open bar output append Op en bar

tion within the stream or if it cannot b e determined

app ending to its end

A selfresetting stream op en lec

eosaction

A Remarks

lamb da s

setter streamp osition s

The value returned by streamposition increases mono

read s

tonically as inputoutput op erations are p erformed Gen

erally this value maybeusedinacallofsetter

streamposition on the same stream

A endofstream streamcondition

A setter streamposition generic function

A Initializati on Options

A Generic Arguments

stream stream A stream

stream stream A stream

A Remarks

position object An integer or the symbol

streamend

Signalled by the default end of stream action as a conse

quence of an input op eration on stream when it is at end of

stream

A Result

Returns t if the p ositionin g op eration was successful other

wise

A close generic function

A Generic Arguments

A Remarks

If position is an integer this sets the p osition of the stream to

stream stream A stream

b e that value If position is streamend this sets the p osition

of the stream to b e the end of the stream The value is

returned if the stream is not p ositionabl e If the value of posi

A Result

tion is to o large or is otherwise inappropriate an error is sig

Returns t if the close op eration was successful otherwise nalled condition class inappropriatestreamposition

Programming Language EuLisp version

A Remarks

A endofstreamp function

Outputs the ob ject to stream

This mo dule denes four metho ds on outputtwo for char

A Arguments

acter le streams and two for string streams In eachcase

the metho ds sp ecialize on characters or sequences

stream A stream

A readline generic function

A Result

Returns t if stream is exhausted otherwise

A Generic Arguments

stream stream A stream

A input generic function

A Result

A Generic Arguments

A string

stream stream A stream

A Remarks

A Result

Reads a line terminated byanewlinecharacter or the end

Reads and returns a single ob ject from the stream The typ e

of the stream from the stream of characters whichisstream

of the ob ject returned dep ends on the typ e of the stream

Returns the line as a string discarding the terminating new

line if any If the stream is already at end of stream then

the stream action is called the default stream action is to

A Remarks

signal an error condition class endofstream

This mo dule denes two metho ds on input one for character

le streams and one for string streams Both metho ds return

characters

A prin function

A uninput generic function

A Arguments

object An ob ject to b e output on stream

A Generic Arguments

stream Acharacter stream on which object is to b e

stream stream A stream

output

object object

A Result

Returns object

A Result

Returns t

A Remarks

Outputs the external representation of object on the output

A Remarks

stream stream using genericprinIfstream is not sp ecied

Replaces object backonto the input stream It is an error if

the standard output stream is used

the ob ject was not the last thing to b e returned by input

This mo dule denes two metho ds on uninput one for char

ASee also standardoutputstream

genericprin acter le streams and one for string streams Both metho ds

sp ecialize on characters for the second argument

A print function

A output generic function

A Arguments

A Generic Arguments

object An ob ject to b e output on stream

stream stream A stream

stream Acharacter stream on which object is to b e

output object object An ob ject

A Result A Result

Returns object Returns object

Programming Language EuLisp version

A Result A Remarks

Returns object

Outputs the external representation of object on the output

stream stream using genericprin followed by a newline

character If stream is not sp ecied the standard output

A Remarks

stream is used

Outputs the external representation of object on the output

stream stream

ASee also standardouptutstream

genericprin

A See also metho ds on genericprin are dened

for character A doublefloat

A fixedprecisioninteger A list A

A write function

string A symbol A and vector A

A Arguments

A genericwrite generic function

object An ob ject to b e output on stream

A Generic Arguments

stream Acharacter stream on which object is to b e

output

object object An ob ject to b e output on stream

stream stream A stream on which object is to b e

A Result

output

Returns object

A Result

A Remarks

Returns object

Outputs the external representation of object on the output

stream stream using genericwriteIfstream is not sp eci

ed the standard output stream is used

A Remarks

Outputs the external representation of object on the output

stream stream

ASee also standardoutputstream

genericwrite

A See also Metho ds on genericwrite are de

ned for character A doublefloat

A fixedprecisioninteger A list A

A newline function

string A symbol A and vector A

A Arguments

A converter string method

stream A stream on which the newline is to b e out

put

A Sp ecialized Arguments

A Result

stream stringstream A string stream

Returns newline

A Result

The currentvalue of the string asso ciated with stream

A Remarks

Outputs a newline character on stream If stream is not

sp ecied the standard output stream is used

A Remarks

The currentvalue is reset to the empty string after the call

to converter

A See also standardoutputstream

A genericprin generic function

A Generic Arguments

object object An ob ject to b e output on stream

stream stream A stream on which object is to b e

output

Programming Language EuLisp version

Table A String Syntax

A Strings

The dened name of this mo dule is string See also sec

tion A collections for further op erations on strings string token

string constituent

string constituent

normal string constituent

A string syntax

digram string constituent

numeric string constituent

normal string constituent

String literals are delimited by the glyph called quotation

level character

mark For example abcd

digram string constituent

aalert

bbackspace

Sometimes it might b e desirable to include string delimiter

ddelete

characters in strings The aim of escaping in strings is to ful

fformfeed

ll this need The stringescape glyph is dened as reverse

llinefeed

solidus String escaping can also b e used to include cer

nnew line

tain other characters that would otherwise b e dicult to

rreturn

denote The set of named sp ecial characters see sections

ttab

and A have a particular syntax to allow their inclusion in

vvertical tab

strings Toallow arbitrary characters to app ear in strings string delimiter

string escape

the hexinsertion digram is followed byaninteger denoting

numeric string constituent

the p osition of the character in the currentcharacter set

x hex digit

Some examples of string literals app ear in Table A The

x hex digit hex digit

syntax for the external representation of strings is dened in

x hex digit hex digit hex digit

Table A

x hex digit hex digit hex digit

hex digit

NOTE At present this do cument refers to the currentchar

acter set but denes no means of selecting alternativecharacter

sets This is to allow for future extensions and implementation

dened extensions which supp ort more than one character set

size fixedprecisioninteger The number

Table A Examples of string literals

of characters in the string Strings are zerobased and

thus the maximum index is size If not sp ecied the size

Example Contents

is zero

anb a newline and b

c c and

fillvalue character Acharacter with whichto

x x followed by space

initiali ze the string The default ll character is x

xabcde xabcd followed by e

xx x followed by x

x x followed by

A Examples

xabcg xabc followed by g

xabc xab followed by c

make string 

make string size  xx

make string size  aaa

The function write outputs a rereadable form of any es

fillvalue a

cap ed characters in the string For example anb input

notation is the string containing the characters newline

a and b The function write pro duces anb

whilst prin pro duces

A stringp function

a

b

A Arguments

The function write outputs characters which do not have

object Ob ject to examine

a glyph asso ciated with their p osition in the character set

as a hex insertion in which all four hex digits are sp ecied

even if there are leading zeros as in the last example in

A Result

Table A The function prin outputs the interpretation

of the characters according to the denitions in section A

Returns object if it is a string otherwise

without the delimiting quotation marks

A converter symbol method

A string class

A Sp ecialized Arguments

The class of all instances of string

string string A string to b e convertedtoasym

bol

A Initializati on Options

Programming Language EuLisp version

A Examples A Result

If the result of symbolexistsp when applied to string is a

a b  t

symb ol that symb ol is returned If the result is then a

b a 

new symb ol is constructed whose name is string This new

a a 

symb ol is returned

a ab  t

ab a 

A B  t

 t

A equal method

a a  t

a bb  t

A Sp ecialized Arguments

a ab  undened

string string A string

A See also Metho d on binary A for characters

string string A string



A

A Result

If the size of string is the same under as that of string



A aslowercase method

then the result is the conjunction of the pairwise application

of equal to the elements of the arguments If not the result

is

A Sp ecialized Arguments

string string A string

A deepcopy method

A Result

A Sp ecialized Arguments

Returns a copyofstring in whicheachcharacter denoting an

string string A string

upp er case character is replaced byacharacter denoting its

lower case counterpart The result must not b e eq to string

A Result

Constructs and returns a copyofstring in which eachele

mentiseql to the corresp onding elementinstring

A asuppercase method

A Sp ecialized Arguments

A shallowcopy method

string string A string

A Sp ecialized Arguments

string string A string

A Result

Returns a copyofstring in whicheachcharacter denoting an

A Result

lower case character is replaced byacharacter denoting its

Constructs and returns a copyofstring in which eachele

upp er case counterpart The result must not b e eq to string

mentiseql to the corresp onding elementinstring

A genericprin method

A binary method

A Sp ecialized Arguments

A Sp ecialized Arguments

string string String to b e ouptut on stream

string string A string

string string A string

stream stream Stream on which string is to b e



ouptut

A Result

If the second argument is longer than the rst the result

A Result

is Otherwise if the sequence of characters in string is

pairwise less than that in string according to binary the The string string



result is t Otherwise the result is Since it is an error

to compare lower case upp er case and digit characters with Output external representation of string on stream as de

any other kind than themselves so it is an error to compare scrib ed in the intro duction to this section interpreting each

two strings which require such comparisons and the results of the characters in the string The op ening and closing quo

are undened tation marks are not output

Programming Language EuLisp version

A Symbols

A genericwrite method

The dened name of this mo dule is symbol

A Sp ecialized Arguments

A symbol syntax

string string String to b e ouptut on stream

stream stream Stream on which string is to b e

The syntax of symb ols also serves as the syntax for identi

ouptut

ers Identiers in EULISP are very similar lexically to iden

tiers in other Lisps and in other programming languages

Informallyanidentier is a sequence of alphabetic digit and

A Result

other characters starting with a character that is not a digit

The string string

Characters which are special see section must b e escap ed

if they are to b e used in the names of identiers However

Output external representation of string on stream as de

b ecause the common notations for arithmetic op erations are

scrib ed in the intro duction to this section replacing single

the glyphs for plus and minus which are also used

characters with escap e sequences if necessary Op ening and

to indicate the sign of a numb er these glyphs are classied

closing quotation marks are output

as identiers in their own rightaswell as b eing part of the

syntax of a number

Sometimes it might b e desirable to incorp orate characters

in an identier that are normally not legal constituents The

aim of escaping in identiers is to change the meaning of

particular characters so that they can app ear where they are

not otherwise acceptable Identiers containing characters

that are not ordinarily legal constituents can b e written by

delimiting the sequence of characters by multipleescape the

glyph for which is called vertical bar The multipleescape

denotes the b eginning of an escap ed part of an identier and

the next multipleescape denotes the end of an escap ed part

of an identier A single character that would otherwise not

b e a legal constituent can b e written by preceding it with

singleescape the glyph for which is called reverse solidus

Therefore singleescape can b e used to incorp orate the

multipleescape or the singleescape character in an identier

delimited or not by multipleescape s For example

is the identier whose name contains the three characters

and andab is the identier whose name

contains the characters a and b The sequence is

the identier with no name and so is but is the

identier whose name contains the single character which

can also b e written without delimitin g multipleescape s

Any identier can b e used as a literal in which cases it de

hanisms notes a symbol Because there are two escaping mec

and b ecause the rst character of a token aects the inter

pretation of the remainder there are manyways in whichto

input the same identier If this same identier is used as a

literal the results of pro cessing each token denoting the iden

tier will b e eq to one another For example the following

tokens all denote the same symbol

whichwillbeoutputby the function write as If out

put by write the representation of the symb ol will p ermit

reconstruction by readescap e characters are preserved

so that equivalence is maintained b etween read and write

for symbols For example ab and abcdef are two sym

b ols as output by write such that read can read them as

twosymb ols If output by prin the escap es necessary to

reread the symb ol will not b e included Thus taking the

same examples prin outputs ab and abcdef which read

interprets as the symbol a followed by the start of a list the

symbol b and the symbol abcdef

The syntax of the external representation of identiers and

Programming Language EuLisp version

Table A IdentierSymb ol Syntax

A Result

Makes a new symb ol whose name by default b egins with

the character g and the remaining characters are generated

symbol

by an implementation den ed mechanism Optionallyan

identifier

alternative prex string for the name may b e sp ecied It

identifier

is guaranteed that the resulting symb ol did not exist b efore

normal identifier peculiar identifier

the call to gensym

normal identifier

normal initial normal constituent

normal initial

letter

A symbolname function

other character

normal constituent

letter

A Arguments

digit

other character

symbol Asymbol

peculiar identifier

peculiar constituent

normal constituent

A Result

peculiar constituent normal constituent

peculiar constituent

Returns a string whichisequal to that given as the argu

letter

ment to the call to make which created symbol Itisanerror

other character

to mo dify this string

A symbolexistsp function

symb ols is dened in Table A

A Arguments

Computationally the most imp ortant asp ect of symbols is

that each is unique or stated the other way around the re

string A string containing the characters to b e used to

sult of pro cessing every syntactic token comprising the same

determine the existence of a symb ol with that name

sequence of characters which denote an identier is the same

ob ject Or more brieyevery identier with the same name

denotes the same symb ol

A Result

Returns the symb ol whose name is string if that symb ol has

already b een constructed by make Otherwise returns

A symbol class

The class of all instances of symbol

A genericprin method

A Initializati on Options

A Sp ecialized Arguments

string string The string containing the characters to

symbol symbol The symb ol to b e output on stream

b e used to name the symb ol The default value for string

is the empty string thus resulting in the symb ol with no

stream stream The stream on which the represen

name written

tation is to b e output

A Result

A symbolp function

The symb ol supplied as the rst argument

A Arguments

A Remarks

object Ob ject to examine

Outputs the external representation of symbol on stream as

describ ed in the intro duction to this section interpreting

eachofthecharacters in the name

A Result

Returns object if it is a symbol

A genericwrite method

A gensym function

A Sp ecialized Arguments

symbol symbol The symb ol to b e output on stream A Arguments

stream stream The stream on which the represen string A string contain characters to b e prep ended to

tation is to b e output the name of the new symbol

Programming Language EuLisp version

A Result A Tables

The symb ol supplied as the rst argument

The dened name of this mo dule is table See also sec

tion A collections for further op erations on tables

A Remarks

Outputs the external representation of symbol on stream as

A table class

describ ed in the intro duction to this section If anycharac

ters in the name would not normally b e legal constituents of

an identier or symb ol the output is preceded and succeeded

The class of all instances of table

bymultipleescap e characters

A Initializati on Options

A Examples

write make symbol string abc  abc

comparator function The function to b e used to

write make symbol string a c  a c

compare keys The default comparison function is eql

write make symbol string 

fillvalue object An ob ject which will b e returned

as the default value for anykey which do es not havean

asso ciated value The default ll value is

A converter string method

hashfunction function The function to b e used to

A Sp ecialized Arguments

compute an unique key for each ob ject stored in the table

This function must return a xed precision integer The

symbol symbol Asymboltobeconverted to a

hash function must also satisfy the constraint that if the

string

comparison function returns true for anytwo ob jects then

the hash function must return the same key when applied

to those two ob jects The default is an implementation

A Result

dened function which satises these conditions

A string

A tablep function

A Remarks

This function is the same as symbolname It is dened for

A Arguments

the sake of symmetry

object Ob ject to examine

A Result

Returns object if it is a table otherwise

A cleartable function

A Arguments

table A table

A Result

An empty table

A Remarks

All entries in table are deleted The result is eq to the argu

ment whichistosay that the argument is mo died

Programming Language EuLisp version

pro cessor must supp ort a maximum vector index of at least A Vectors

The dened name of this mo dule is vector See also sec

tion A collections for further op erations on vectors

A equal method

A vector syntax

A Sp ecialized Arguments

vector vector Avector

Avector is written as obj obj For example

n

is a vector of three elements the integers and

vector vector Avector



The representations of obj are determined by the exter

i

nal representations dened in other sections of this deni

tion see character A fixedprecisioninteger

A Result

A float A list A string A and

If the size of vector is the same under asthatofvector



symbol A as well as instances of vector itself The

then the result is the conjunction of the pairwise application

syntax for the external representation of vectors is dened

of equal to the elements of the arguments If not the result

in Table A

is

Table A Vector Syntax

A deepcopy method

vector

object

A Sp ecialized Arguments

vector vector Avector

A vector class

A Result

Constructs and returns a copyofvectorinwhicheach ele

The class of all instances of vector

ment is the result of calling deepcopy on the corresp onding

elementofvector

A Initializati on Options

A shallowcopy method

size fixedprecisioninteger The number of ele

ments in the vector Vectors are zerobased and thus the

maximum index is size If not supplied the size is zero

A Sp ecialized Arguments

fillvalue object An ob ject with which to initial

vector vector Avector

ize the vector The default ll value is

A Result

A Examples

Constructs and returns a copyofvector in whicheach ele

make vector 

mentiseql to the corresp onding elementinvector

make vector size 

make vector size  a a a

fillvalue a

A genericprin method

A vectorp function

A Sp ecialized Arguments

vector vector Avector to b e ouptut on stream

A Arguments

stream stream A stream on which the representa

object Ob ject to examine

tion is to b e output

A Result

A Result

Returns object if it is a vector otherwise

The vector supplied as the rst argument

A Remarks

A maximumvectorindex integer

Output the external representation of vector on stream as de

scrib ed in the intro duction to this section Calls the generic

A Remarks

function again to pro duce the external representation of the

This is an implementationde ned constant A conforming elements stored in the vector

Programming Language EuLisp version

A Syntax of Level ob jects

A genericwrite method

This section rep eats the syntax for reading and writing of

the various classes dened in Annex A

A Sp ecialized Arguments

object

character A

vector vector Avector to b e ouptut on stream

float A

integer A

stream stream A stream on which the representa

list A

tion is to b e output

string A

symbol A

vector A

A Remarks

Output the external representation of vector on stream as de

scrib ed in the intro duction to this section Calls the generic

character token

function again to pro duce the external representation of the

literal character token

special character token elements stored in the vector

control character token

numeric character token

literal character token

letter

decimal digit

nonalphabetic

control character token

letter

special character token

alert

backspace

delete

formfeed

linefeed

newline

return

tab

space

verticaltab

numeric character token

x hex digit

x hex digit hex digit

x hex digit hex digit hex digit

x hex digit hex digit hex digit

hex digit

float

signunsigned float exponent

sign

unsigned float

float format

float format

float format

float format

decimal integer A

float format

decimal integer A

float format

float format decimal integer A

exponent

double exponent A

double exponent

d D sign decimal integer A

Programming Language EuLisp version

integer string token

signunsigned integer string constituent

sign string constituent

normal string constituent

unsigned integer digram string constituent

binary integer numeric string constituent

octal integer normal string constituent

decimal integer level character

hexadecimal integer digram string constituent

specified base integer a alert

binary integer b backspace

b binary digit binary digit d delete

binary digit f formfeed

l linefeed

octal integer n new line

eturn o octal digit octal digit r r

t tab octal digit

v vertical tab

string delimiter decimal integer

string escape decimal digit decimal digit

numeric string constituent hexadecimal integer

x hex digit x hexadecimal digit hexadecimal digit

x hex digit hex digit hexadecimal digit

x hex digit hex digit hex digit decimal digit

x hex digit hex digit hex digit hex lower letter

hex digit hex upper letter

hex lower letter

a b c d e f

hex upper letter

symbol

A B C D E F

identifier

specified base integer

identifier

base specification r

normal identifier peculiar identifier

specified base digit

normal identifier

specified base digit

normal initial normal constituent

base specification

normal initial

decimal digit

letter

decimal digit

other character

normal constituent

specified base digit

letter

decimal digit letter

digit

other character

peculiar identifier

peculiar constituent null

normal constituent

peculiar constituent normal constituent pair

peculiar constituent object object

letter list

other character empty list proper list improper list

empty list

proper list

vector

object

object

improper list

object object

Programming Language EuLisp version

Annex B

normative

Programming Language EuLisp Level

initial value of the slot This option must only b e sp ecied B Classes and Ob jects

once for a particular slot The same initarg name maybe

used for several slots in which case they will share the

B defclass dening form

same initial value if the initarg is given to make

initform form The value of this option is a form which

B Syntax

is evaluated as the default value of the slot to b e used if

no initarg is dened for the slot or given to a call to make

defclass form The form is evaluated in the lexical environment of the call

defclass

to defstruct and the dynamic environment of the call to

class name

make The form is evaluated each time make is called and

superclass list

the default value is called for The order of evaluation of

defclass slot description list

the initforms in all the slots is determined by initialize

defclass class option

This option must only b e sp ecied once for a particular

superclass list

slot

superclass name

defclass slot description list

reader symbol The value is the identier of the variable

defclass slot description

defclass slot option

to which the reader function will b e b ound The reader

initform level expression

function is a means to access the slot The reader func

identifier level expression

tion is a function of one argument which should b e an

defstruct slot option

instance of the new class No writer function is automati

defclass class option

cally b ound with this option This option can b e sp ecied

class class name

more than once for a slot creating several readers It is an

identifier level expression

error to sp ecify the same reader writer or accessor name

defstruct class option

for two dierent slots

writer symbol The value is the identier of the variable

to which the writer function will b e b ound The writer

B Arguments

function is a means to change the slot value The creation

of the writer is analogous to that of the reader function

classname A symb ol naming a binding to b e initiali sed

This option can b e sp ecied more than once for a slot It

with the new class

is an error to sp ecify the same reader writer or accessor

name for t wo dierentslots

superclass A list of symb ols naming bindings of

classes to b e used as the sup erclasses of the new class

accessor symbol The value is the identier of the vari

This is dierent from defstruct at level where only

able to which the reader function will b e b ound In ad

one sup erclass may b e sp ecied

dition the use of this slotoption causes that the writer

function is asso ciated to the reader via the setter mech

slotdescription A list of slot sp ecications see b e

anism This option can b e sp ecied more than once for a

low comprising either a slotname or a list of a slotname

slot It is an error to sp ecify the same reader writer or

followed by some slotoptions One of the class options

accessor name for two dierentslots

see b elow allows the sp ecication of the class of the slot

description

identier expression The symb ol named by identier

and the value of expression are passed to make of the slot

classoption A sequence of keys and values see b elow

description class along with other slot options The values

One of the class options class allows the sp ecication

are evaluated in the lexical and dynamic environmentof

of the class of the class b eing dened

the defclassFor the language dened slot description

classes no slot initargs are dened which are not sp ecied

B Remarks

by particular defclass slot options

This dening form denes a new class The resulting class

The classoption s are interpreted as follows

will b e b ound to classname The second argument is a list of

sup erclasses If this list is empty the sup erclass is object

initargs list The value of this option is a list of iden

The third argument is a list of slotdescriptions The remain

tiers naming symbols which extend the inherited names

ing arguments are class options All the slot options and class

of arguments to b e supplied in the initoption s of a call

options are exactly the same wayasfordefstruct

to make on the new class Initargs are inherited by union

The values of all legal arguments in the call to make are the

The slotoption s are interpreted as follows

initial values of corresp onding slots if they name a slot or

are ignored by the default initialize metho d otherwise

initarg symbol The value of this option is a identier

This option must only b e sp ecied once for a class

naming a symb ol which is the name of an argumenttobe

initoption s of a call to make on the new supplied in the

class The value of this argument in the call to make is the Creates a constructor constructor constructorspec

Programming Language EuLisp version

which defaults to method and nonstandard options The function for the new class The constructor sp ecication

latter are evaluated in the lexical and dynamic environment gives the name to which the constructor function will b e

of genericlambda and passed to make of the generic func b ound followed by a sequence of legal initargs for the class

tion as additional initiali zati on arguments The additional The new function creates an instance of the class and lls

initoption sover level are interpreted as follows in the slots according to the matchbetween the sp ecied

initargs and the given arguments to the constructor func

class gfclass The class of the new generic function tion This option may b e sp ecied more than once

This must b e a sub class of genericfunction The de

fault is genericfunction predicate symbol Creates a predicate function for the

new class The predicate sp ecication gives the name to

methodclass methodclass The class of all metho ds to which the predicate function will b e b ound This option

b e dened on this generic function All metho ds of a may b e sp ecied anynumb er of times for a class

generic function must b e instances of this class The

methodclass must b e a sub class of method and defaults class class The value of this option is the class of the

to method new class By default this is class This option must

only b e sp ecied once for the new class

identier expression The symb ol named by identier

and the value of expression are passed to make as initargs identier expression The symb ol named by identier

and the value of expression are passed to make on the class

The values are evaluated in the lexical and dynamic envi

ronment of the defgeneric This option is used for classes of the new class This list is app ended to the end of the

list that defclass constructs The values are evaluated

which need extra information not provided by the stan

dard options in the lexical and dynamic environment of the defclass

This option is used for metaclasses which need extra in

In addition metho d init options can b e sp ecied for the indi formation not provided by the standard options

vidual metho ds on a generic function These are interpreted

as follows

B Generic Functions

class methodclass The class of the metho d to b e de

ned The metho d class must b e a sub class of method

B genericlambda macro

and is by default methodThevalue is passed to make

as the rst argument The symb ol and the value are not

passed as initargs to make

B Syntax

identier expression The symb ol named by identier

generic lambda form

and the value of expression are passed to make creating

genericlambda gf lambda list

a new metho d as initargs The values are evaluated in the

level init option

lexical and dynamic environment of the genericlambda

level init option

This option is used for classes which need extra informa

class class name

tion not provided by the standard options

methodclass class name

method level method description

identifier level expression

B Examples

level init option

level method description

In the following example an anonymous version of gf see

method init option

defgeneric is dened In all other resp ects the resulting

specialized lambda list

ob ject is the same as gf

form

method init option

genericlambda arg arg classa

class class name

identifier level expression

class anothergfclass

classkeya classvaluea

classkeyb classvalueb

B Arguments

methodclass anothermethodclassa

gflambdalist As level See section

method class anothermethodclassb

methodclassbkeya methodclassbvaluea

levelinitoption Format as level but with addi

marg classb marg classc

tional options which are dened b elow

method methodclassakeya methodclassavaluea

marg classd marg classe

B Result

method class anothermethodclassc

A generic function

methodclassckeya methodclasscvaluea

marg classf marg classg

B Remarks

The syntax of genericlambda is an extension of the level

syntax allowing additional initoptions These allow the

sp ecication of the class of the new generic function which

B See also defgeneric defaults to genericfunction the class of all metho ds

Programming Language EuLisp version

method class anothermethodclassb

methodclassbkeya methodclassbvaluea

B defgeneric dening form

marg classb marg classc

a methodclassavaluea method methodclassakey

B Syntax

marg classd marg classe

method class anothermethodclassc

defgeneric form

methodclassckeya methodclasscvaluea

defgeneric

marg classf marg classg

gf name

gf lambda list

level init option

B Metho ds

B Arguments

gf name As level See section

B methodlambda macro

gf lambda list As level See section

init option As for genericlambda dened ab ove b e

B Syntax

low

method lambda form

methodlambda

B Remarks

method init option B

This dening form denes a new generic function The re

specialized lambda list

sulting generic function will b e b ound to gfname The sec

form

ond argument is the formal parameter list An error is sig

nalled condition noncongruentlambdalistsifanyof

the metho ds dened on this generic function do not have

lamb da lists congruent to that of the generic function This

B Arguments

applies b oth to metho ds dened at the same time as the

generic function and to any metho ds added subsequently by

method init option A quoted symb ol followed byanex

defmethod or addmethodAninitoption is a identier fol

pression

lowed by its initial value The syntax of defgeneric is an

extension of the level syntax The rewrite rules for the

specializedlambda list As dened under

defgeneric form are identical to those given in Table ex

genericlambda

cept that level init option replaces level init option

form An expression

B Examples

In the following example of the use of defgeneric a generic

function named gf is dened The dierences b etween this

B Result

function and gf see are

This syntax creates and returns an anonymous metho d with

the given lamb da list and b o dyThisanonymous metho d

a The class of the generic function is sp ecied

can later b e added to a generic function with a congruent

anothergfclass along with some initoptions re

lamb da list via the generic function addmethod Note that

lated to the creation of an instance of that class

the lamb da list can b e sp ecialized to sp ecify the metho ds do

main The value of the sp ecial initarg class determines the

b The default class of the metho ds to b e attached to the

class to instantiate the rest of the initlist is passed to make

generic function is sp ecied anothermethodclassa

called with this class The default metho d class is method

along with an initoption related to the creation of an in

stance of that class

B Remarks

c In addition some of the metho ds to b e attached are

of a dierent metho d class anothermethodclassb

The additional methodinitoption s includes class for sp eci

and anothermethodclassc also with metho d sp e

fying the class of the metho d to b e dened and nonstandard

cic initoptions These metho d classes are sub classes of

options which are evaluated in the lexical and dynamic en

anothermethodclassa

vironmentofmethodlambda and passed to initialize of

that metho d

defgeneric gf arg arg classa

class anothergfclass

B defmethod macro

classkeya classvaluea

classkeyb classvalueb

methodclass anothermethodclassa

B Syntax

Programming Language EuLisp version

method A metho d

defmethod form

nextmethods A list of metho ds

defmethod gf name

method init option B

specialized lambda list

form form A sequence of expressions

n

form

form An expression

n

This function is identical to callmethod except that its last

B Remarks

argument is a list whose elements are the other arguments

to pass to the metho ds metho d function The dierence is

The defmethod form of level extends that of level to ac

the same as that b etween normal function application and

cept methodinitoption s This allows for the sp ecication of

apply

the metho d class by means of the class init option This

class must b e a sub class of the metho d class of the host

generic function The metho d class otherwise defaults to

that of the host generic function In all other resp ects the

B callmethodfunction function

b ehaviour is as that dened in level

B Arguments

B methodfunctionlambda macro

methodfn A metho d function

B Arguments

nextmethods A list of metho d functions

lambdalist A lambda list

A sequence of expressions form

form A sequence of forms

This function calls the metho d function methodfn with ar

guments args The methodfn must have b een created by

This macro creates and returns an anonymous metho d func

methodfunctionlambda The argument nextmethods is a

tion with the given lamb da list and b o dy This anony

list of metho d functions which are used as the applicabl e

mous metho d function can later b e added to a metho d using

metho d list for the form s it is an error if this list is dierent

setter methodfunctionorasthe function initiali za

from the metho d functions in the list of metho ds whichwould

tion value in a call of make on an instance of methodA

b e pro duced by the metho d lo okup function of the generic

function of this typ e is also returned by the metho d acces

function of the metho d to which the metho d function is at

sor methodfunction and can b e called using the sp ecial

tached These metho d functions are used to determine the

metho d function calling functions callmethodfunction

next metho d to call when callnextmethod is called within

and applymethodfunction Only functions created using

methodfn

this macro can b e used as metho d functions Note that the

lamb da list must not b e sp ecialized a metho ds domain is

stored in the metho d itself

B applymethodfunction function

B Arguments

B callmethod function

methodfn A metho d function

B Arguments

nextmethods A list of metho d functions

method A metho d

form form A sequence of expressions

n

nextmethods A list of metho ds

form An expression

n

arg A sequence of expressions

This function is identical to callmethodfunction except

This function calls the metho d method with arguments args

that its last argument is a list whose elements are the other

The argument nextmethods is a list of metho ds which are

arguments to pass to the metho d function The dierence is

used as the applicabl e metho d list for args it is an error if this

the same as that b etween normal function application and

list is dierent from the metho ds whichwould b e pro duced

apply

by the metho d lo okup function of the generic function of

method If method is not attached to a generic function

its b ehavior is unsp ecied The nextmethods are used to

determine the next metho d to call when callnextmethod

is called within methodfn

B applymethod function

B Arguments

Programming Language EuLisp version

object abstractclass

B Ob ject Introsp ection

class class

abstractclass class

The only reective capability whichevery ob ject p ossesses is

functionclass class

the ability to nd its class

slotdescription abstractclass

localslotdescription class

function abstractclass

B classof function

genericfunction functionclass

method class

B Arguments

Figure B Level class hierarchy

object An ob ject

e The initarg whichisasymb ol to access the value

B Result

which can b e supplied to a make call in order to initializ e

The class of the ob ject

the corresp onding slot in a newly created ob ject

The metaob ject classes dened for slot descriptions at level

B Remarks

are shown in Table B

The function classof can takeany LISP ob ject as argument

and returns an instance of class representing the class of

that entity

B classprecedencelist function

B Class Introsp ection

B Arguments

Standard classes are not redenable and supp ort single in

class A class

heritance only General multiple inheritance or mixin in

heritance can b e provided by extensions Nor is it p ossi

ble to use a class as a sup erclass which is not dened at

B Result

the time of class denition Again such forward reference

A list of classes starting with class itself suc

facilities can b e provided by extensions The distinction

ceeded by the sup erclasses of class and ending with

between metaclasses and nonmetaclasses is made explicit

object This list is equivalent to the result of calling

by a sp ecial class named metaclass which is the class

computeclassprecedencelist

of all metaclasses This is dierent from Ob jVlisp where

whether a class is a metaclass dep ends on the sup erclass list

of the class in question It is implementationde ned whether

B Remarks

metaclass itself is sp ecializab le or not This implies that

implementations are free to restrict the instantiation tree The class precedence list is used to control the inheritance

excluding the selnstantiati on lo op of metaclasstoa of slots and metho ds

depth of three levels

The minimum information asso ciated with a class metaob

B classslotdescriptions function

ject is

a The class precedence list ordered most sp ecic rst

B Arguments

b eginning with the class itself

class A class

b The list of eective slot descriptions

c The list of eective initargs

B Result

A list of slotdescriptions one for each of the slots of an

Standard classes supp ort lo cal slots only Shared slots can b e

instance of class

provided by extensions The minimal information asso ciated

with a slot description metaob ject is

B Remarks

a The name which is required to p erform inheritance

The slotdescriptions determine the instance size number of

computations

slots and the slot access

b The initfunction called by default to compute the

initial slot value when creating a new instance

B classinitargs function

c The reader which is a function to read the corresp ond

ing slot value of an instance

B Arguments

d The writer which is a function to write the corre

class A class

sp onding slot of an instance

Programming Language EuLisp version

B Result B Result

Alistofsymb ols which can b e used as legal keywords to

A function of no arguments that is used to compute the

initiali ze instances of the class

initial value of the slot in the absence of a supplied value

B Remarks

B slotdescriptionslotreader function

The initargs corresp ond to the keywords sp ecied in the

initarg slotoption or the initargs classoption when the

class and its sup erclasses were dened

B Arguments

slotdescription A slot description

B Slot Introsp ection

B Result

B slotdescription class

A function of one argument that returns the value of the slot

in that argument

The abstract class of all slot descriptions

B slotdescriptionslotwriter function

B localslotdescription class

B Arguments

The class of all lo cal slot descriptions

slotdescription A slot description

B Initializati on Options

B Result

name string The name of the slot

A function of two arguments that installs the second argu

ment as the value of the slot in the rst argument

reader function The function to access the slot

writer function The function to up date the slot

B Generic Function Introsp ection

initfunction function The function to compute the

The default generic dispatchscheme is classbased that is

initial value in the absence of a supplied value

metho ds are class sp ecic The default argument precedence

order is lefttoright

initarg symbol The key to access a supplied initial

value

The minimum information asso ciated with a generic function

metaob ject is

The default value for all initoptions is false

a The domain restricting the domain of eachadded

metho d to a sub domain

B slotdescriptionname function

b The metho d class restricting each added metho d to

b e an instance of that class

B Arguments

c The list of all added metho ds

slotdescription A slot description

d The metho d lo okup function used to collect and sort

B Result

the applicabl e metho ds for a given domain

The symb ol whichwas used to name the slot when the class

e The discriminati ng function used to p erform the

of which the slotdescriptio n is part was dened

generic dispatch

B Remarks

The slot description name is used to identify a slot descrip

B genericfunctiondomain function

tion in a class It has no eect on bindings

B Arguments

B slotdescriptioninitfunction function

genericfunction A generic function

B Arguments

B Result

slotdescription A slot description

A list of classes

Programming Language EuLisp version

B Result B Remarks

This function returns the domain of a generic function The

A function

domains of all metho ds attached to a generic function are

constrained to b e within this domain In other words the

domain classes of each metho d must b e sub classes of the

B Remarks

corresp onding generic function domain class It is an error

This function returns a function whichmay b e applied

to mo dify this list

to the same arguments as the generic function This

function is called to p erform the generic dispatchoper

ation to determine the applicable metho ds whenever the

B genericfunctionmethodclass function

generic function is called and call the most sp ecic ap

plicable metho d function This function is created by

computediscriminatingfunction

B Arguments

genericfunction A generic function

B Metho d Introsp ection

The minimal information asso ciated with a metho d metaob

B Result

ject is

This function returns the class which is the class of all meth

o ds of the generic function Each metho d attached to a

a The domain which is a list of classes

generic function must b e an instance of this class When

a metho d is created using defmethod methodlambdaorby

b The function comprising the co de of the metho d

using the method generic function option in a defgeneric

or genericlambda it will b e an instance of this class by

c The generic function to which the metho d has b een

default

added or if it is attached to no generic function

The metaob ject classes for generic functions dened at level

B genericfunctionmethods function

are shown in Table B

B Arguments

B methoddomain function

genericfunction A generic function

B Arguments

B Result

This function returns a list of the metho ds attached to the

method Amethod

generic function The order of the metho ds in this list is

undened It is an error to mo dify this list

B Result

A list of classes dening the domain of a metho d

B genericfunctionmethodlookupfunction

function

B methodfunction function

B Arguments

genericfunction A generic function

B Arguments

method Amethod

B Result

A function

B Result

B Remarks

This function returns a function which implements the

metho d The returned function which is called when method

This function returns a function which when applied to the

is called either by calling the generic function with appro

arguments given to the generic function returns a sorted list

priate arguments through a callnextmethodorby using

of applicable metho ds The order of the metho ds in this list

callmethod A metho d metaob ject itself cannot b e applied

is determined by computemethodlookupfunction

or called as a function

B genericfunctiondiscriminatingfunction

B methodgenericfunction function

function

B Arguments

B Arguments

genericfunction A generic function

method Amethod

Programming Language EuLisp version

B Result

B computepredicate method

This function returns the generic function to which method

is attached if method is not attached to a generic function

it returns

B Sp ecialized Arguments

B Class Initialization

class class Aclass

B initialize method

B Result

Computes and returns a function of one argument which

B Sp ecialized Arguments

returns true when applied to direct or indirect instances of

class and false otherwise

class class A class

initlist list A list of initializa tion options as fol

lows

B computeconstructor generic function

name symbol Name of the class b eing initiali zed

B Generic Arguments

directsuperclasses list List of direct sup erclasses

class class Aclass

directslotdescriptions list List of direct slot

sp ecications

parameters list The argumentlistofthefunction

b eing created

directinitargs list List of direct initargs

B Result

B Result

The initializ ed class

Computes and returns a constructor function for class

B Remarks

The initializ atio n of a class takes place as follows

B computeconstructor method

a Check compatibili ty of direct sup erclasses

B Sp ecialized Arguments

b Perform the logical inheritance computations of

class class Aclass

class precedence list

parameters list The argumentlistofthefunction

initargs

b eing created

slot descriptions

c Compute new slot accessors and ensure all new and

B Result

inherited accessors to work correctly on instances of the

Computes and returns a constructor function which returns

new class

a new instance of class

d Make the results accessible by class readers

The basic call structure is laid out in Figure B

B allocate generic function

Note that computeinitargs is called by the default

initialize metho d with all direct initargs as the second

B Generic Arguments

argument those sp ecied as slot option and those sp ecied

as class option

class class Aclass

initlist list A list of initializa tion arguments

B computepredicate generic function

B Result

B Generic Arguments

An instance of the rst argument

class class A class

B Remarks

B Result

Computes and returns a function of one argument whichis Creates an instance of the rst argument Users may dene

a predicate function for class new metho ds for new metaclasses

Programming Language EuLisp version

compatiblesuperclassesp cl directsuperclasses boolean

compatiblesuperclassp cl superclass boolean

computeclassprecedencelist cl directsuperclasses cl

computeinheritedinitargs cl directsuperclasses initarg

computeinitargs cl directinitargs inheritedinitargs initarg

computeinheritedslotdescriptions cl directsuperclasses sd

computeslotdescriptions cl slotspecs inheritedsds sd

either

computedefinedslotdescription cl slotspec sd

computedefinedslotdescriptionclass cl slotspec sdclass

or

computespecializedslotdescription cl inheritedsds slotspec sd

computespecializedslotdescriptionclass

cl inheritedsds slotspec sdclass

computeinstancesize cl eectivesds integer

computeandensureslotaccessors cl eectivesds inheritedsds sd

computeslotreader cl sd eectivesds function

computeslotwriter cl sd eectivesds function

ensureslotreader cl sd eectivesds reader function

computeprimitivereaderusingslotdescription

sd cl eectivesds function

computeprimitivereaderusingclass cl sd eectivesds function

ensureslotwriter cl sd eectivesds writer function

iption computeprimitivewriterusingslotdescr

sd cl eectivesds function

computeprimitivewriterusingclass cl sd eectivesds function

Figure B Initialization Call Structure

reader function A slot reader function

B allocate method

writer function A slot writer function

B Sp ecialized Arguments

B Result

class class A class

The initialize d slot description

initlist list A list of initial izati on arguments

B Generic Function Initialization

B Result

B initialize method

An instance of the rst argument

B Sp ecialized Arguments

B Remarks

gf genericfunction A generic function

The default metho d creates a new uninitial i zed instance of

the rst argument The initlist is not used bythisallocate

initlist list A list of initial iza tion options as fol

metho d

lows

name symbol The name of the generic function

B Slot Description Initialization

domain list List of argument classes

B initialize method

methodclass class Class of attached metho ds

B Sp ecialized Arguments

method methoddescription A metho d to b e attached

This option may b e sp ecied more than once

slotdescription slotdescription A slot descrip

tion

B Result

initlist list A list of initial izati on options as fol

The initialize d generic function

lows

name symbol The name of the slot

B Remarks

initfunction function A function

This metho d initiali zes and returns the genericfunction

The sp ecied metho ds are attached to the generic func

initarg symbol A symbol tion by addmethod and its slots are initial ized from

Programming Language EuLisp version

B Result the information passed in initlist and from the re

sults of calling computemethodlookupfunction and

Returns the result of calling compatiblesuperclassp on

computediscriminatingfunction on the generic function

class and the rst elementofthedirectsuperclasses single

Note that these two functions may not b e called during the

inheritance assumption

call to initialize and that they may b e called several times

for the generic function

B compatiblesuperclassp generic function

The basic call structure is addmethod gf method gf

computemethodlookupfunction gf domain function

computediscriminatingfunction gf domain lookupfn methods

B Generic Arguments

function

subclass class A class

superclass class A p otential direct sup erclass

B Metho d Initialization

B initialize method

B Result

Returns t if subclass is compatible with superclass otherwise

B Sp ecialized Arguments

method method A metho d

B compatiblesuperclassp method

initlist list A list of initializa tion options as fol

lows

B Sp ecialized Arguments

domain list The list of argument classes

subclass class A class

function fn A function created with

methodfunctionlambda

superclass class A p otential direct sup erclass

genericfunction gf A generic function

B Result

Returns t if the class of the rst argument is a sub class of

B Result

the class of the second argument otherwise

This metho d returns the initial ized metho d metaob ject

method If the genericfunction option is supplied If the implementation wishes to restrict the instantiation tree

addmethod is called to install the new metho d in the see intro duction to B this metho d should return false if

genericfunction superclass is metaclass

B Inheritance Proto col

B compatiblesuperclassp method

B compatiblesuperclassesp generic function

B Sp ecialized Arguments

B Generic Arguments

subclass class A class

class class A class

superclass abstractclass A p otential direct su

p erclass

directsuperclasses list A list of p otential direct

sup erclasses of class

B Result

Always returns t

B Result

Returns t if class is compatible with directsuperclasses oth

erwise

B compatiblesuperclassp method

B Sp ecialized Arguments

B compatiblesuperclassesp method

subclass abstractclass A class

B Sp ecialized Arguments

superclass class A p otential direct sup erclass

class class A class

B Result

directsuperclasses list A list of p otential direct

sup erclasses

Always returns

Programming Language EuLisp version

B Result

B compatiblesuperclassp method

Computes and returns the list of eective slot descriptions

of class

B Sp ecialized Arguments

B

See also computeinheritedslotdescriptions

subclass abstractclass A class

superclass abstractclass Apotential direct su

p erclass

B computeslotdescriptions method

B Result

B Sp ecialized Arguments

Always returns t

class class Class b eing dened

slotspecs list List of direct slot sp ecications

B computeclassprecedencelist generic function

inheritedslotdescriptionlists list A list of lists

in fact one list in single inheritance of inherited slot de

B Generic Arguments

scriptions

class class Class b eing dened

B Result

directsuperclasses list List of direct sup erclasses

A list of eective slot descriptions

B Result

B Remarks

Computes and returns a list of classes which represents the

The default metho d computes two sublists

linearized inheritance hierarchyofclass and the given list

of direct sup erclasses b eginning with class and ending with

a Calling

object

computespecializedslotdescription with the three

arguments i class ii each inheritedslotdescription as

a singleton list iii the slotspec corresp onding byhaving

the same name to the slot description if it exists other

B computeclassprecedencelist method

wise giving a list of the sp ecialized slot descriptions

b Calling computedefinedslotdescription with

B Sp ecialized Arguments

the three arguments i class ii each slotspecication

whichdoesnothav e a corresp onding byhaving the same

class class Class b eing dened

name inheritedslotdescription

directsuperclasses list List of direct sup erclasses

The metho d returns the concatenation of these two lists as

its result The order of elements in the list is signicant

B Result

All sp ecialized slot descriptions have the same p osition as

in the eective slot descriptions list of the direct sup erclass

A list of classes

due to the single inheritance The slot accessors computed

later may rely on this assumption minimizing the number of

metho ds to one for all sub classes and minimizing the access

B Remarks

time to an indexed reference

This metho d can b e considered to return a cons of class

and the class precedence list of the rst elementofdirect

superclasses single inheritance assumption If no direct

B

superclasses has b een supplied the result is the list of two

See also computespecializedslotdescription

elements class and object

computedefinedslotdescription

computeandensureslotaccessors

B computeslotdescriptions generic function

B computeinitargs generic function

B Generic Arguments

B Generic Arguments

class class Class b eing dened

class class Class b eing dened

directslotspecications list A list of direct slot

sp ecication

initargs list List of direct initargs

inheritedslotdescriptions list A list of lists of in

inheritedinitarglists list A list of lists of inher

herited slot descriptions

ited initargs

Programming Language EuLisp version

B Result B Result

List of symb ols

List of lists of inherited slot descriptions

B Remarks

B Remarks

Computes and returns all legal initargs for class

The result of the default metho d is a list of one element a

list of eective slot descriptions of the rst elementofthe

second argument single inheritance assumption Its result

B See also computeinheritedinitargs

is used by computeslotdescriptions as an argument

B computeinitargs method

B computeinheritedinitargs generic function

B Sp ecialized Arguments

B Generic Arguments

class class Class b eing dened

class class Class b eing dened

initargs list List of direct initargs

directsuperclasses list List of direct sup erclasses

inheritedinitarglists list A list of lists of inher

ited initargs

B Result

List of lists of symb ols

B Result

List of symb ols

B Remarks

Computes and returns a list of lists of initargs Its result is

B Remarks

used by computeinitargs as an argument

This metho d app ends the second argument with the rst

element of the third argument single inheritance assump

B See also computeinitargs

tion removes duplicates and returns the result Note

that computeinitargs is called by the default initialize

metho d with all direct initargs as the second argument those

sp ecied as slot option and those sp ecied as class option

B computeinheritedinitargs method

B Sp ecialized Arguments

B computeinheritedslotdescriptions

generic function

class class Class b eing dened

B Generic Arguments

directsuperclasses list List of direct sup erclasses

class class Class b eing dened

B Result

directsuperclasses list List of direct sup erclasses

List of lists of symb ols

B Result

B Remarks

List of lists of inherited slot descriptions

The result of the default metho d contains one list of legal

initargs of the rst element of the second argument single

inheritance assumption

B Remarks

Computes and returns a list of lists of eective slot descrip

tions

B computedefinedslotdescription

generic function

B See also computeslotdescriptions

B Generic Arguments

B computeinheritedslotdescriptions method

class class Class b eing dened

slotspec list Canonicaliz ed slot sp ecication

B Sp ecialized Arguments

class class Class b eing dened

B Result

directsuperclasses list List of direct sup erclasses

Slot description

Programming Language EuLisp version

B Result B Remarks

The class localslotdescription

Computes and returns a new eective slot description It

is called by computeslotdescriptions on each slot sp ec

ication which has no corresp onding inherited slot descrip

B Remarks

tions

This metho d just returns the class

localslotdescription

B

See also computedefinedslotdescriptionclass

B computespecializedslotdescription

generic function

B computedefinedslotdescription method

B Generic Arguments

B Sp ecialized Arguments

class class Class b eing dened

class class Class b eing dened

inheritedslotdescriptions list List of inherited

slotspec list Canonicalized slot sp ecication

slot descriptions each of the same name as the slot b e

ing dened

B Result

slotspec list Canonicalized slot sp ecication or

Slot description

B Result

B Remarks

Slot description

Computes and returns a new eective slot descrip

tion The class of the result is determined by calling

computedefinedslotdescriptionclass

B Remarks

Computes and returns a new eective slot description It is

B

called by computeslotdescriptions on the class each list

See also computedefinedslotdescriptionclass of inherited slots with the same name and with the sp ecial

ising slot sp ecication list or if no one is sp ecied with

the same name

B computedefinedslotdescriptionclass

generic function

B

See also computespecializedslotdescriptionclass

B Generic Arguments

B computespecializedslotdescription

class class Class b eing dened

method

slotspec list Canonicalized slot sp ecication

B Sp ecialized Arguments

B Result

class class Class b eing dened

Slot description class

inheritedslotdescriptions list List of inherited

slot descriptions

B Remarks

Determines and returns the slot description class corresp ond

slotspec list Canonicalized slot sp ecication or

ing to class and slotspec

B See also computedefinedslotdescription

B Result

Slot description

B computedefinedslotdescriptionclass

B Remarks

method

Computes and returns a new eective slot descrip

tion The class of the result is determined by calling

B Sp ecialized Arguments

computespecializedslotdescriptionclass

class class Class b eing dened

B

slotspec list Canonicalized slot sp ecication

See also computespecializedslotdescriptionclass

Programming Language EuLisp version

slotdescription is b ound to the sp ecied identier Thus if

a readerwriter option is sp ecied more than once the same

B computespecializedslotdescriptionclass

ob ject is b ound to all the identiers If the accessor slot

generic function

option is sp ecied the anonymous writer will b e installed as

the setter of the reader Sp ecialized slotdescriptions refer

B Generic Arguments to the same ob jects as those in the sup erclasses single in

heritance makes that p ossible Since the readerswriters are

class class Class b eing dened el to add generic it is p ossible for a sub class at the metalev

new metho ds for inherited slotdescription s in order to make

the readerswriters applicable on instances of the sub class

inheritedslotdescriptions list List of inherited

A new metho d might b e necessary if the sub classes havea

slot descriptions

dierent instance allo cation or if the slot p ositions cannot

be kept the same as in the sup erclass in multiple inheri

slotspec list Canonicalize d slot sp ecication or

tance extensions This can b e done during the initializa tion

computations

B Result

Slot description class

B computeandensureslotaccessors

generic function

B Remarks

B Generic Arguments

Determines and returns the slot description class corresp ond

ing to i the class b eing dened ii the inherited slot de

scriptions b eing sp ecialized iii the sp ecializi ng information

class class Class b eing dened

in slotspec

slotdescriptions list List of eective slot descrip

tions

B

See also computespecializedslotdescription

inheritedslotdescriptions list List of lists of in

herited slot descriptions

B computespecializedslotdescriptionclass

B Result method

List of eective slot descriptions

B Sp ecialized Arguments

B Remarks

class class Class b eing dened

Computes new accessors or ensures that inherited accessors

inheritedslotdescriptions list List of inherited

work correctly for each eective slot description

slot descriptions

slotspec list Canonicalize d slot sp ecication or

B computeandensureslotaccessors method

B Sp ecialized Arguments

B Result

The class localslotdescription

class class Class b eing dened

slotdescriptions list List of eective slot descrip

B Remarks

tions

This metho d just returns the class

localslotdescription

inheritedslotdescriptions list List of lists of in

herited slot descriptions

B Slot Access Proto col

B Result

The slot access proto col is dened via accessors readers and

List of eective slot descriptions

writers only There is no primitive like CLOSs slotvalue

The accessors are generic for standard classes since they

havetowork on sub classes and should do the applicabil i ty

B Remarks

checkanyway The key idea is that the discriminati on on

For each slot description in slotdescriptions the default

slotdescriptions and classes is p erformed once at class de

metho d checks if it is a new slot description and not an

nition time rather than again and again at slot access time

inherited one If the slot description is new

Each slotdescription has exactly one reader and one writer

a calls computeslotreader to compute a new slot as anonymous ob jects If a readerwriter slotoption is sp eci

reader and stores the result in the slot description ed in a class denition the anonymous readerwriter of that

Programming Language EuLisp version

b calls computeslotwriter to compute a new slot slotdescriptions list List of eective slot descrip

writer and stores the result in the slot description tions

Otherwise it assumes that the inherited values remain valid

B Result

Finally for every slot description new or inherited

Function

it ensures the reader and writer work correctly on in

stances of class by means of ensureslotreader and

ensureslotwriter

B Remarks

Computes and returns a new slot writer applicable to in

B computeslotreader generic function

stances of class and anyvalue to b e stored as the new slot

value corresp onding to slotdescription The third argument

can b e used in order to compute the logical slot p osition

B Generic Arguments

class class Class

B computeslotwriter method

slotdescription slotdescription Slot

description

B Sp ecialized Arguments

slotdescriptionlist list List of eective slot de

scriptions

class class Class

slotdescription slotdescription Slot

B Result

description

Function

slotdescriptions list List of eective slot descrip

tions

B Remarks

Computes and returns a new slot reader applicabl e to in

stances of class returning the slot value corresp onding to

B Result

slotdescription The third argument can b e used in order to

compute the logical slot p osition

Generic function

B computeslotreader method

B Remarks

The default metho d returns a new generic function of two

arguments without any metho ds Its domain is class

B Sp ecialized Arguments

object

class class Class

slotdescription slotdescription Slot

B ensureslotreader generic function

description

slotdescriptions list List of eective slot descrip

B Generic Arguments

tions

class class Class

B Result

slotdescription slotdescription Slot

Generic function

description

slotdescriptions list List of eective slot descrip

B Remarks

tions

The default metho d returns a new generic function of one

argument without any metho ds Its domain is class

reader function The slot reader

B computeslotwriter generic function

B Result

Function

B Generic Arguments

class class Class

B Remarks

slotdescription slotdescription Slot Ensures function correctly fetches the value of the slot from

description instances of class

Programming Language EuLisp version

slotdescription slotdescription Slot

description

B ensureslotreader method

slotdescriptionlist list List of eectiveslotde

B Sp ecialized Arguments

scriptions

class class Class

writer genericfunction The slot writer

slotdescription slotdescription Slot

description

B Result

Generic function

slotdescriptions list List of eective slot descrip

tions

B Remarks

reader genericfunction The slot reader

The default metho d checks if there is a metho d in the

genericfunction If not creates and adds a new one oth

erwise it assumes that the existing metho d works correctly

B Result

The domain of the new metho d is class object and the

Generic function

function is

methodfunctionlambda obj class

B Remarks

newvalue object

The default metho d checks if there is a metho d in the

primitivewriter obj newvalue

genericfunction If not it creates and adds a new one oth

erwise it assumes that the existing metho d works correctly

computeprimitivewriterusingslotdescription is

The domain of the new metho d is class and the function is

called by ensureslotwriter metho d to compute the prim

itive writer used in the function of the new created writer

methodfunctionlambda object class metho d

primitivereader object

computeprimitivereaderusingslotdescription is

B computeprimitivereaderusingslotdescription

called by ensureslotreader metho d to compute the prim

generic function

itive reader used in the function of the new created reader

metho d

B Generic Arguments

slotdescription slotdescription Slot

B ensureslotwriter generic function

description

class class Class

B Generic Arguments

slotdescriptions list List of eective slot descrip

class class Class

tions

slotdescription slotdescription Slot

description

B Result

slotdescriptions list List of eective slot descrip

Function

tions

writer function The slot writer

B Remarks

Computes and returns a function which returns a slot value

when applied to an instance of class

B Result

Function

B computeprimitivereaderusingslotdescription

method

B Remarks

Ensures function correctly up dates the value of the slot in

B Sp ecialized Arguments

instances of class

slotdescription slotdescription Slot

description

B ensureslotwriter method

class class Class

B Sp ecialized Arguments

slotdescriptions list List of eective slot descrip

tions

class class Class

Programming Language EuLisp version

B Result B Result

Function

Function

B Remarks

B Remarks

Computes and returns a function which stores a new slot

Calls computeprimitivereaderusingclass This is the

value when applied on an instance of class and a new value

default metho d

B computeprimitivereaderusingclass

B computeprimitivewriterusingslotdescription

generic function

method

B Sp ecialized Arguments

B Generic Arguments

slotdescription slotdescription Slot

class class Class

description

slotdescription slotdescription Slot

class class Class

description

slotdescriptions list List of eective slot descrip

slotdescriptions list List of eective slot descrip

tions

tions

B Result

B Result

Function

Function

B Remarks

B Remarks

Calls computeprimitivewriterusingclass This is the

Computes and returns a function which returns the slot value

default metho d

when applied to an instance of class

B computeprimitivewriterusingclass

B computeprimitivereaderusingclass

generic function

method

B Generic Arguments

B Sp ecialized Arguments

class class Class

class class Class

slotdescription slotdescription Slot

slotdescription slotdescription Slot

description

description

slotdescriptions list List of eective slot descrip

slotdescriptions list List of eective slot descrip

tions

tions

B Result

B Result

Function

Function

B Remarks

B Remarks

Computes and returns a function which stores the new slot

The default metho d returns a function of one argument

value when applied on an instance of class and new value

B computeprimitivewriterusingslotdescription

B computeprimitivereaderusingclass

generic function

method

B Generic Arguments

B Sp ecialized Arguments

slotdescription slotdescription Slot

class class Class

description

slotdescription slotdescription Slot

class class Class

description

slotdescriptions list List of eective slot descrip

slotdescriptions list List of eective slot descrip

tions

tions

Programming Language EuLisp version

domain list A list of classes which span the do B Result

main

Function

lookupfn function The metho d lo okup function

B Remarks

methods list Alistofmethodsattached to the

The default metho d returns a function of two arguments

genericfunction

B Metho d Lo okup and Generic Dispatch

B Result

A function

B computemethodlookupfunction

generic function

B Remarks

This generic function computes and returns a function which

B Generic Arguments

is called whenever the generic function is called The re

turned function controls the generic dispatch Users mayde

gf genericfunction A generic function

ne metho ds on this function for new generic function classes

to implement nondefault dispatch strategies

domain list A list of classes whichcover the do

main

B computediscriminatingfunction method

B Result

A function

B Sp ecialized Arguments

gf genericfunction A generic function

B Remarks

Computes and returns a function which will b e called at

domain list A list of classes which span the do

least once for each domain to select and sort the applicabl e

main

metho ds by the default dispatchmechanism New meth

ods may b e dened for this function to implement dierent

lookupfn function The metho d lo okup function

metho d lo okup strategies Although only one metho d lo okup

function generating metho d is provided by the system each

methods list Alistofmethodsattached to the

generic function has its own sp ecic lo okup function which

genericfunction

mayvary from generic function to generic function

B Result

A function

B computemethodlookupfunction method

B Remarks

B Sp ecialized Arguments

This metho d computes and returns a function which is called

gf genericfunction A generic function

whenever the generic function is called This default metho d

implements the standard dispatch strategy The generic

domain list A list of classes whichcover the do

functions metho ds are sorted using the function returned

main

by computemethodlookupfunction and the rst is called

as if by callmethod passing the others as the list of next

metho ds Note that callmethod need not b e directly called

B Result

A function

B addmethod generic function

B Remarks

B Generic Arguments

Computes and returns a function which will b e called at least

once for each domain to select and sort the applicable meth

gf genericfunction A generic function

ods by the default dispatchmechanism It is not dened

whether each generic function mayhaveitsown lo okup func

method method A metho d to b e attached to the

tion

generic function

B computediscriminatingfunction

B Result

generic function

This generic function adds method to the generic function

gf This metho d will then b e taken into account when gf

B Generic Arguments is called with appropriate arguments It returns the generic

function gf New metho ds may b e dened on this generic

gf genericfunction A generic function function for new generic function and metho d classes

Programming Language EuLisp version

B LowLevel Allo cation Primitives B Remarks

In contrast to CLOS addmethod do es not remove a metho d

This mo dule provides primitives which are necessary to im

with the same domain as the metho d b eing added Instead

plement new allo cation metho ds p ortably However they

a noncontinuable error is signalled

should b e dened in suchaway that ob jects cannot b e de

stroyed unintentionall y In consequence it is an error to use

primitiveclassof primitiveref and their setters on

B addmethod method

ob jects not created by primitiveallocate

B Sp ecialized Arguments

B primitiveallocate function

gf genericfunction A generic function

method method A metho d to b e attached

B Arguments

class A class

B Result

The generic function

size An integer

B Remarks

B Result

This metho d checks that the domain classes of the

An instance of the rst argument

metho d are sub classes of those of the generic function

and that the metho d is an instance of the generic func

tions metho d class If not signals an error condition

incompatiblemethodandgf It also checks if there B Remarks

is a metho d with the same domain already attached to

This function returns a new instance of the rst ar

the generic function If so a noncontinuabl e error is sig

gument which has a vectorlike structure of length

naled condition methodsexists If no error o ccurs

size The comp onents of the new instance can b e ac

the metho d is added to the generic function Dep ending

cessed using primitiveref and up dated using setter

on particular optimizations of the generic dispatch adding

primitiverefItisintended to b e used in new allocate

a metho d may cause some up dating computations eg

metho ds dened for new metaclasses

by calling computemetho dlo okup functio n and compute

discriminatin gfuncti on

B primitiveclassof function

B Arguments

object An ob ject created by primitiveallocate

B Result

A class

B Remarks

This function returns the class of an ob ject It is similar to

classofwhichhasadenedbehaviour on any ob ject It is

an error to use primitiveclassof on ob jects whichwere

not created by primitiveallocate

B setter primitiveclassof setter

B Arguments

object An ob ject created by primitiveallocate

class A class

B Result

The class

Programming Language EuLisp version

B Dynamic Binding B Remarks

This function supp orts p ortable implementations of

B dynamic special form

a dynamic classicatio n like changeclass in CLOS

b automatic instance up dating of redened classes

B Syntax

dynamic form

B primitiveref function

dynamic identifier

B Arguments

B Arguments

object An ob ject created by primitiveallocate

identier A symb ol naming a dynamic binding

index The index of a comp onent

B Result

B Result

An ob ject

The value of closest dynamic binding of identier is returned

If no visible binding exists an error is signaled condition

unbounddynamicvariable

B Remarks

Returns the value of the ob jects comp onent corresp onding

to the supplied index It is an error if index is outside the

B dynamicsetq special form

index range of object This function is intended to b e used

when dening new kinds of accessors for new metaclasses

B Syntax

B setter primitiveref function

dynamic setq form

dynamicsetq identifier form

B Arguments

object An ob ject created by primitiveallocate

B Arguments

index The index of a comp onent

identier Asymb ol naming a dynamic binding to b e

value The new value which can b e any ob ject

up dated

form An expression whose value will b e stored in the

B Result

dynamic binding of identier

The new value

B Result

B Remarks

The value of form

Stores and returns the new value as the ob jects comp onent

corresp onding to the supplied index It is an error if index is

outside the index range of object This function is intended

B Remarks

to b e used when dening new kinds of accessors for new

The form is evaluated and the result is stored in the closest

metaclasses

dynamic binding of identier If no visible binding exists an

error is signaled condition unbounddynamicvariable

B unbounddynamicvariable executioncondition

B Initializati on Options

symbol symbol A symb ol naming the unb ound dy

namic variable

B Remarks

Signalled by dynamic or dynamicsetq if the given dynamic

variable has no visible dynamic binding

Programming Language EuLisp version

a reconsideration of the dened mo del Another unpleasant as

p ect of the current mo del is that it is not clear how to address

B dynamiclet special form

the issue of imp orting or hiding dynamic variablesthey are in

every sense global which conicts with the principle of mo dule

abstraction A mo del in which a separate topdynamic environ

B Syntax

ment is asso ciated with each mo dule is under consideration for a

later version of the denition

dynamic let form

dynamiclet

binding

B dynamicmultiplydefined executioncondition

form

B Initializati on Options

B Arguments

symbol symbol Asymb ol naming the dynamic variable

which has already b een dened

binding A list of binding sp eciers

body A sequence of forms

B Remarks

Signalled by defvar if the named dynamic variable already

B Result

exists

The sequence of formsisevaluated in order returning the

value of the last one as the result of the dynamiclet form

B Exit Extensions

B Remarks

B catch macro

A binding sp ecier is either an identier or a two element

list of an identier and an initiali zi ng form All the initial

B Syntax

izing forms are evaluated from left to right in the current

environment and the new bindings for the symb ols named

by the identiers are created in the dynamic environmentto

catch macro

hold the results These bindings have dynamic scop e and

catch tag form

dynamic extent Each form in body is evaluated in order in

tag

the environment extended by the ab ove bindings The result

symbol A

of evaluating the last form in body is returned as the result

of dynamiclet

B Remarks

B defvar dening form

The catch op erator is similar to block except that the scop e

of the name tag of the exit function is dynamic The catch

tag must b e a symbol b ecause it is used as a dynamic variable

B Syntax

to create a dynamically scop ed binding of tag to the contin

uation of the catch form The continuation can b e invoked

defvar form anywhere within the dynamic extentofthecatch form by

defvar identifier expression

using throw The forms are evaluated in sequence and the

value of the last one is returned as the value of the catch

form The rewrite rules for catch are

B Arguments

catch Is an error

catch tag progn tag

identier A symb ol naming a top dynamic binding con

catch tag form letcc tmp

taining the value of form

dynamiclet tag tmp

form

form The form whose value will b e stored in the top

dynamic binding of identier

Exiting from a catchby whatever means causes the restora

tion of the lexical environment and dynamic environment

B Remarks

that existed b efore the catch was entered The ab ove rewrite

The value of form is stored as the top dynamic value

for catch causes the variable tmp to b e shadowed This is

of the symb ol named by identier The binding created

an artifact of the ab ove presentation only and a conforming

by defvar is mutable An error is signaled condition

pro cessor must not shadowanyvariables that could o ccur in

dynamicmultiplydefined on pro cessing this form more

the b o dy of catch in this way

than once for the same identier

NOTE The problems engendered by crossmo dule reference

necessitated by a single topdynamic environment are leading to B See also throw

Programming Language EuLisp version

defgeneric form

B throw macro

defgeneric

gf name

gf lambda list

B Syntax

level init option

throw macro

throw tag form

defmethod form

defmethodgfname

method init option B

specialized lambda list

form

B Remarks

In throw the tag names the continuation of the catch from

which to return throw is the invo cation of the continuation

defvar form

of the catch named tagTheform is evaluated and the value

defvar identifier expression

are returned as the value of the catch named by variable The

tag ia a symb ol b ecause it used to access the current dynamic

binding of the symb ol which is where the continuation is

B Syntax of Level expressions

b ound The rewrite rules for throw are

dynamic form

dynamic identifier

throw Is an error

throw tag dynamic tag

throw tag form dynamic tag form

dynamic setq form

dynamicsetq identifier form

B See also catch

dynamic let form

dynamiclet

B Summary of Level Expressions and Def

binding

initions

form

This section gives the syntax of all level expressions and

denitions together Any pro ductions undened here app ear

generic lambda form

elsewhere in the denition sp ecically the syntax of most

genericlambda gf lambda list

expressions and denitions is given in the section dening

level init option

level

level init option

class class name

methodclass class name

B Syntax of Level dening forms

method level method description

identifier level expression

level init option

level module form

level method description

level expression

method init option

level module form

specialized lambda list

form

method init option

defclass form

class class name

defclass

identifier level expression

class name

superclass list

defclass slot descriptionlist

method lambda form

defclass class option

methodlambda

superclass list

method init option B

superclass name

specialized lambda list

defclass slot description list

form

defclass slot description

defclass slot option

initform level expression

identifier level expression

catch macro

defstruct slot option

catch tag form

defclass class option

tag

class class name

symbol A

identifier level expression

defstruct class option

throw macro

throw tag form

Programming Language EuLisp version

References Slade S The T Programming Language a Dialect

of Lisp PrenticeHall

Alb erga CN BosmanClark C Mikelsons M

Steele Jr GL Digital

Van Deusen M and Padget JA Exp erience with an

Press Second edition Digital Press

Uncommon Lisp In Pro ceedings of ACM Sym

p osium on Lisp and Functional ProgrammingACM

Stoyan H et al Towards a Lisp Standard In Pro

Press New York Also available as IBM

ceedings of Europ ean Conference on Articial In

Research Rep ort RC

telligence

Bobrow DG DeMichiel LG Gabriel RP

Teitelman W The Interlisp Reference ManualXe Keene SE Kiczales G and Mo on DA Common

Lisp Ob ject System Sp ecication SIGPLAN Notices

roxPalo Alto ResearchCenter

Septemb er

Bretthauer H and Kopp J The MetaClass

System MCS A Portable Ob ject System for Common

Lisp Do cumentation Arb eitspapiere der GMD

Gesellschaft fur Mathematik und Datenverarb eitung

GMD Sankt Augustin July

Chailloux J Devin M and Hullot JM LELISP

APortable and Ecient Lisp System In Pro ceedings

of ACM Symp osium on Lisp and Functional Pro

grammingACM Press New York

Chailloux J Devin M Dup ont F Hullot JM

Serp ette B and Vuillemin J LeLisp de lINRIA

Version Manuel de reference INRIA Ro cquen

court



Clinger W and Rees JA editors The Revised

Rep ort on Scheme SIGPLAN Notices Decem

b er

Cointe P Metaclasses are First Class the Ob jVlisp

mo del In Pro ceedings of OOPSLA ACM Press

Decemb er published as SIGPLAN No

tices Vol No

Hudak P and Wadler P editors Rep ort on

the Functional Programming Language Haskell SIG

PLAN Notices May

Lang KJ and Pearlmutter BA Oaklisp An

Ob jectOriented Dialect of Scheme Lisp and Symb olic

Computation June

MacQueen D Mo dules for Standard ML In Pro

ceedings of ACM Symp osium on Lisp and Func

tional ProgrammingACM Press New York

Milner R et al Standard MLTechnical Rep ort

Lab oratory for the Foundations of Computer Science

University of Edinburgh

Padget JA et al Desiderata for the Standard

isation of Lisp In Pro ceedings of ACM Sym

p osium on Lisp and Functional ProgrammingACM

Press New York

Pitman KM An Error System for Common Lisp

ISOWG do cumentN

Rees JA The T ManualTechnical Rep ort Yale

University

Shalit A Dylan an ob jectoriented dynamic lan

guage Apple Computer Inc

Programming Language EuLisp version

Class Index

character character

charfilestream stream

classname

condition condition

cons list

doublefloat double

fixedprecisioninteger fpint

float oat

integer integer

localslotdescription level

lock lo ck

null list

number numb er

object level

slotdescription level

stream stream

string string

stringstream stream

structure level

symbol symbol

table table

thread thread

vector vector

Programming Language EuLisp version

Condition Index

acondition

arithmeticcondition numb er

cannotupdatesetter level

cannotupdatesetter level

collectioncondition collection

conversioncondition collection

divisionbyzero numb er

domaincondition elementaryfunctions

dynamicmultiplydefined level

endofstream stream

environmentcondition condition

executioncondition condition

inappropriatestreamposition stream

dgf level incompatiblemethodan

incompatiblemethoddomain level

invalidoperator level

methoddomainclash level

methodexists level

noapplicablemethod convert

noconverter convert

noncongruentlambdalists level

nonextmethod level

nosetter level

rangecondition elementaryfunctions

scanmismatch formattedio

teloscondition level

threadalreadystarted thread

threadcondition thread

unbounddynamicvariable level

wrongconditionclass condition

wrongthreadcontinuation threads

Programming Language EuLisp version

ConstantIndex

fpi fpint

leastnegativedoublefloat double

leastpositivedoublefloat double

maximumvectorindex vector

mostnegativedoublefloat double

mostnegativefixedprecisioninteger fpint

mostpositivedoublefloat double

mostpositivefixedprecisioninteger fpint

nil level

pi elementaryfunctions

t level

tickspersecond event

Programming Language EuLisp version

Function Index

number primitiveref level

stream number prin

print stream

number

scan formattedio number

setter level

compare

setter car list compare

setter cdr list number

setter converter convert abs number

setter element collection afunction

setter primitiveclassof level allocate level

setter primitiveref level apply level

signal condition applymethod level

signum number applymethodfunction level

slotdescriptioninitfunction level atom list

slotdescriptionname level callmethod level

slotdescriptionslotreader level

callmethodfunction level

slotdescriptionslotwriter level car list

standarderrorstream stream

cdr list

standardinputstream stream cerror condition

standardoutputstream stream

characterp character

stringp string classinitargs level

symbolexistsp symb ol

classof level

symbolnam e symb ol classprecedencelist level

symbolp symbol

level classslotdescriptions

cleartable table tablep table

threadp thread

conditionp condition

threadreschedule thread

cons list

threadstart thread

consp list

threadvalue thread

convert convert

unlock lo ck

converter convert

vectorp vector

currentthread thread

write stream

doublefloatp double

endofstreamp stream

eq compare

eql compare

error condition

fixedprecisionintegerp fpint

floatp oat

format formattedio

gcd number

genericfunctiondiscriminatingfunction level

genericfunctiondomain level

genericfunctionmethodclass level

genericfunctionmethodloo kupfunction level

genericfunctionmethods level

gensym symb ol

integerp integer

lcm number

list list

lock lo ck

lockp lo ck

make level

max compare

methoddomain level

methodfunction level

methodgenericfunction level

min compare

negativep numb er

newline stream

null list

numberp numb er

oddp integer

open stream

positivep numb er

primitiveallocate level

primitiveclassof level

Programming Language EuLisp version

Macro Index

and level

block level

catch level

cond level

defmethod level

defmethod level

genericlambda level

genericlambda level

let level

let level

methodfunctionlambda level

methodlambda level

or level

quasiquote syntax

returnfrom level

throw level

Programming Language EuLisp version

Generic Function Index

accumulate collection genericprin stream

genericwrite stream accumulate collection

initialize level

acos elementaryfunctions

input stream addmethod level

log elementaryfunctions

ageneric

log elementaryfunctions allocate level

map collection anyp collection

member collection asin elementaryfunctions

negate number aslowercase character

output stream asuppercase character

pow elementaryfunctions atan elementaryfunctions

readline stream atan elementaryfunctions

reverse collection binary numb er

round oat binary numb er

sequencep collection binary numb er

setter streamposition stream

binary numb er

shallowcopy copy binary compare

sin elementaryfunctions

binary compare

sinh elementaryfunctions binary numb er

size collection

binarygcd numb er

sqrt elementaryfunctions binarylcm numb er

streamp stream

binarymod numb er

streamposition stream ceiling oat

tan elementaryfunctions

characterstreamp stream

tanh elementaryfunctions close stream

truncate oat

collectionp collection

uninput stream

compatiblesuperclasse sp level

wait event

compatiblesuperclassp level

zerop numb er

computeandensureslotaccessors level

computeclassprecedencelist level

computeconstructor level

computedefinedslotdescription level

computedefinedslotdescriptionclass level

computediscriminatingfunction level

computeinheritedinitargs level

computeinheritedslotdesc riptions level

computeinitargs level

computemethodlookupfunction level

computepredicate level

computeprimitivereaderusingclass level

computeprimitivereaderusingslotdescription

level

computeprimitivewriterusingclass level

computeprimitivewriterusingslotdescription

level

s level computeslotdescription

computeslotreader level

computeslotwriter level

computespecializedslotdescription level

computespecializedslotdescriptionclass level

concatenate collection

cos elementaryfunctions

cosh elementaryfunctions

deepcopy copy

do collection

element collection

emptyp collection

ensureslotreader level

ensureslotwriter level

equal compare

evenp integer

exp elementaryfunctions

filestreamp stream

fill collection

floor oat

flush stream

Programming Language EuLisp version

Metho d Index

converter vector collection acos double

cos double addmethod level

cosh double ageneric

deepcopy copy allocate level

deepcopy copy asin double

deepcopy list aslowercase character

deepcopy string aslowercase string

deepcopy vector asuppercase character

ensureslotreader level asuppercase string

ensureslotwriter level atan double

equal character atan double

equal compare binary double

equal double binary fpint

equal fpint binary double

equal list binary fpint

equal string binary double

equal vector binary fpint

evenp fpint binary double

exp double binary fpint

floor double binary character

genericprin character binary double

genericprin double binary fpint

genericprin fpint binary string

genericprin list binary double

genericprin list binary fpint

genericprin string binary fpint

genericprin symb ol binarygcd fpint

genericprin vector binarylcm fpint

genericwrite character ceiling double

genericwrite double compatiblesuperclassesp level

genericwrite fpin compatiblesuperclassp level t

genericwrite list compatiblesuperclassp level

genericwrite list compatiblesuperclassp level

genericwrite string compatiblesuperclassp level

genericwrite symbol computeandensureslotaccessors level

genericwrite vector computeclassprecedencelist level

initialize condition computeconstructor level

initialize level

computedefinedslotdescription level

initialize level computedefinedslotdescriptionclass level

initialize level computediscriminatingfunction level

initialize level computeinherited initargs level

initialize level computeinheritedslotdescriptions level

input stream computeinitargs level

log double computemethodlookupfunction level

log double computepredicate level

mod double computeprimitivereaderusingclass level

mod fpint computeprimitivereaderusingclass level

negate double computeprimitivereaderusingslotdescription

negate fpint level

ription output stream computeprimitivewriterusingslotdesc

pow double

level

computeslotdescriptions level round double

computeslotreader level shallowcopy copy

computeslotwriter level shallowcopy copy

computespecializedslotdescription level shallowcopy list

computespecializedslotdescriptionclass level shallowcopy string

shallowcopy vector

converter doublefloat fpint sin double

converter fixedprecisioninteger double sinh double

converter list collection sqrt double

converter string collection tan double

converter string double tanh double

converter string fpint truncate double

converter string stream uninput stream

converter string sym b ol wait thread

converter symbol string zerop double

converter table collection zerop fpint

Programming Language EuLisp version

General Index

base

arbitrary base literals

limitation on input converter doublefloat

binary literals converter fixedprecisioninteger

binary converter list

binary converter string

binary converter symbol

binarygcd converter table

binarylcm converter vector

binarymod setter car

binary setter cdr

binary setter converter

binary setter element

binary setter primitiveclassof

dynamicall y scop ed setter primitiveref

mo dule setter streamposition

of mo dule names

top dynamic

block

see also letcc

b o olean

callmethod charfilestream

callmethodfunction character

callnextmethod classname

car condition

case sensitivity cons

catch doublefloat

cdr fixedprecisioninteger

ceiling float

integer cerror

localslotdescription character

lock character

null characterextension glyph

number mo dule

object characterstreamp

slotdescription characterp

stream class

stringstream primitive

string selfinstantiated

structure classinitargs

symbol classof

table classprecedencelist

thread riptions classslotdesc

vector cleartable

CLOS

afunction close

ageneric co ercion

aspecialform collection

abs alignment

accumulate mo dule

accumulate collectioncon di tion

acos collectionp

addmethod comment

allocate commentbegin glyph

and Common Lisp Error System

anyp mo dule

apply compatiblesuperclassp

applymethod compatiblesuperclassesp

applymethodfunction compliance

aslowercase computeandensureslotaccessors

asuppercase computeclassprecedencelist

asin computeconstructor

assignment computedefinedslotdescription

atan computedefinedslotdescriptionclass

computediscriminating atan function

atom computeinheritedinitargs

backquoting computeinheritedslotdescriptions

Programming Language EuLisp version

do computeinitargs

double oat computemethodlookupfunction

mo dule computepredicate

doublefloatp computeprimitivereaderusingclass

dynamic computeprimitivereaderusingslotdescription

dynamic environment computeprimitivewriterusingclass

dynamic error computeprimitivewriterusingslotdescription

dynamiclet computeslotdescriptions

dynamicsetq computeslotreader

element er computeslotwrit

elementary functions computespecializedslotdescription

emptyp computespecializedslotdescriptionclass

endofstreamp concatenate

ensureslotreader cond

ensureslotwriter condition

environmental error continuable

eq noncontinuable

implementation den ed b ehaviour conditionp

eql conguration

equal conformance

error level

error level

can b e signalled conforming pro cessor

dynamic conforming program

environmental conformity clause

handler least negative double precision oat

signalled least p ositive double precision oat

static maximum vector index

evenp most negative double precision oat

exp most negative xed precision integer

extension most p ositive double precision oat

oating p oint most p ositive xed precision integer

integer cons

list consp

null empty list constant

pair dened

string literal

vector continuation

external representation see also prin and write conventions

false convert

filestreamp mo dule

fill converter

xed precision integer cos

mo dule cosh

fixedprecisionintegerp currentthread

oat deepcopy

float defclass

floatp defcondition

floor defconstant

flush defgeneric

format dening form

formattedio defclass

function defcondition

calling defconstant

reader defgeneric

standard function deo cal

writer defstruct

function call defvar

gcd deflocal

generic arithmetic defmacro

generic function defmethod

lamb dalist defmodule

genericfunctiondiscriminatingfunction defstruct

genericfunctiondomain defun

genericfunctionmethodclass defvar

genericfunctionmethodlookupfunction direct instance

genericfunctionmethods direct sub class

direct sup erclass genericlambda

Programming Language EuLisp version

thread genericprin

vector genericwrite

character gensym

collection Haskell

compare hexadecimal literals

condition identier

convert denition of

copy p eculiar identiers

doubleoat syntax

elementaryfunctions if

eulisplevel implementationde ned

oat b ehaviour of eq

formattedio least negative double precision oat

fpi least p ositive double precision oat

integer maximum vector index

lo ck mo dule directives

numb er most negative double precision oat

stream most negative xed precision integer

string most p ositive double precision oat

symb ol most p ositive xed precision integer

table time units p er second

thread unhandled conditions

vector indirect instance

lexical environment indirect sub class

list single

list inheritance graph

mo dule inherited slot description

literal initlist

arbitrary base initarg

binary initform

character initfunction

hexadecimal initializ ation

mo dication of initialize

o ctal inner dynamic

quotation inner lexical

k lo c input

lock instance

lockp direct

log indirect

log instantiation graph

macro integer

denition by defmacro integer

macro expansionsee also syntax integerp

macrossee also syntax labels

make lambda

map lcm

max LeLisp

MCS let

member let

metaclass letcc

metho d see also block and returnfrom

bindings level

sp ecicity character

metho d sp ecicity charfilestream

methoddomain doublefloat

methodfunction float

methodfunctionlambda fixedprecisioninteger

methodgenericfunction integer

methodlambda lock

MicroCeyx null

min object

mod cons

mo dule stream

directives string

environments stringstream

exp ort structure

exp ose symbol

imp ort table

Programming Language EuLisp version

name bindings slot description

syntax slot option

multimetho d slot sp ecication

negate slotdescriptioninitfunction

negativep slotdescriptionname

new instance slotdescriptionslotreader

newline slotdescriptionslotwriter

nextmethodp sp ecial form

null asp ecialform

null callnextmetho d

numb er dynamic

co ercion dynamiclet

mo dule dynamicsetq

numberp if

Oaklisp lab els

ob ject lamb da

syntax letcc

Ob jVLisp nextmetho dp

o ctal literals progn

oddp quote

open setq

or unwindprotect

output withhandler

pair sp ecialize

pair sp ecialize on

positivep sqrt

pow Standard ML

primitiveallocate standard mo dule

primitiveclassof rorstream standarder

primitiveref standardinputstream

prin standardoutputstream

print static error

constants stream

symb ols mo dule

pro cessor streamposition

gensym names streamp

progn string

quasiquotation string

quasiquote escaping in

abbreviation with mo dule

quote stringescap e glyph

abbreviation with stringp

rangecondition sub class

readline direct

reective indirect

returnfrom sup erclass

see also letcc direct

symbol reverse

symb ol round

mo dule scan

symbolexistsp in labels expressions

symbolname of dynamiclet bindings

symbolp of lambda bindings

syntax of letcc binding

selfinstantiated class

character sequencep

constant setq

defmacro setter

defmo dule setter function

defun shallowcopy

oat signal

function call signum

generic function lambdalist simple function

identier sin

integer single inheritance

pair sinh

string size

symb ol slot

Programming Language EuLisp version

unquote

unquotesplicin g

vector

syntax expansion

T

table

mo dule

tablep

tan

tanh

thread

threadreschedule

threadstart

threadvalue

threadp

throw

top dynamic

top lexical

true

truncate

uninput

unlock

unquote

abbreviation with

unquotesplicing

abbreviation to

unwindprotect

vector

vector

vectorp

wait

denition of

withhandler

write

zerop

Common Lisp

level

level

libraries

InterLISP

LELISP

LISPVM