Programming Language Eulisp

Version

Programming Language EuLisp version

Contents Page

Foreword

Intro duction

Scop e

Normative References

Conformance Denitions

Error Denitions

Compliance

Conventions

Layout and Typ ography

Metalanguage

Naming

Denitions

Syntax

Whitespace and Comments

Mo dules

Imp orts

Syntax

Exp orts

Denitions and Expressions

Mo dule Pro cessing

Mo dule Denition

defmodule

Ob jects

Creating and Initializin g Ob jects

initialize

initialize

Accessing Slots

External Representation

genericprin

genericwrite

Classes and Slot Desciptions

Inheritance

Slot Descriptions

System Dened Classes

Dening Classes

defstruct

defclass

slotdescription

Creating Ob jects

make ii

Programming Language EuLisp version

teloscondition

Generic Functions and Metho ds

Dening Generic Functions and Metho ds

defgeneric

defmethod

noapplicablemethod

incompatiblemethodsignature

noncongruentlambdalists

Sp ecializi ng Metho ds

callnextmethod

nonextmethod

nextmethodp

Threads and Semaphores

Threads

thread

threadp

threadreschedule

currentthread

threadstart

threadvalue

wait

threadcondition

wrongthread

oldthread

genericprin

genericwrite

Semaphores

semaphore

semaphorep

opensemaphore

closesemaphore

genericprin

genericwrite

Conditions

condition

executioncondition

environmentcondition

Condition Handling

signal

wrongconditionclass

withhandler

Conditions

conditionp

conditionmessage

initializeinstance

error

cerror

defcondition

Expressions Denitions and Control Forms

Atomic Expressions

constant

defconstant

symbol

deflocal

Literal Expressions

quote

Functions Application Denition

lambda

function call

invalidoperator

defmacro

defun

apply

badapplyargument iii

Programming Language EuLisp version

Assignments

setq

setter

nosetter

cannotupdatesetter

Conditional Expressions

if

cond

and

or

Variable Binding and Sequences

letcc

labels

let

let

progn

unwindprotect

Waiting on Events

wait

tickspersecond

Quasiquotation Expressions

quasiquote

unquote

unquotesplicing

improperunquotesplice

Summary of Level Expressions and Denitions

Annexes

A Level Mo dule Library

A Characters

A character

A character

A characterp

A converter integer

A equal

A copy

A genericprin

A genericwrite

A genericwrite

A Collections

A emptyp

A size

A member

A do

A map

A reduce

A reduce

A fill

A catenate

A filter

A Comparing Ob jects

A eq

A

A eql

A equal

A equal

A Conversion

A convert

A conversioncondition

A noconverter

A converter

A setter converter

A Copying Ob jects

A copy

A copy

A Double Precision Floats

A doublefloat iv

Programming Language EuLisp version

A doublefloat

A doublefloatp

A mostpositivedoublefloat

A leastpositivedoublefloat

A leastnegativedoublefloat

A mostnegativedoublefloat

A truncate

A truncate

A round

A round

A floor

A floor

A ceiling

A ceiling

A converter string

A converter singleprecisioninteger

A integerconversionoverflow

A copy

A genericprin

A genericwrite

A Elementary Functions

A pi

A sin

A cos

A tan

A acos

A asin

A atan

A atan

A exp

A log

A log

A log

A sqrt

A sqrt

A sqrt

A expt

A sinh

A cosh

A tanh

A asinh

A acosh

A atanh

A FormattedIO

A scanmismatch

A scan

A format

A The empty list

A

A null

A null

A length

A genericprin

A genericwrite

A Numb ers

A number

A numberp

A integer

A integerp

A float

A floatp

A arithmeticcondition

A equal

A

A

A

A

A v

Programming Language EuLisp version

A

A

A

A max

A min

A gcd

A lcm

A abs

A zerop

A signum

A positivep

A negativep

A binaryplus

A binarydifference

A negate

A binarytimes

A binarydivide

A binarylt

A binarygcd

A binarylcm

A Pairs and Lists

A pair

A pair

A consp

A atom

A cons

A car

A cdr

A setter car

A setter cdr

A converter string

A notacharacter

A converter string

A equal

A copy

A list

A length

A copyalist

A copylist

A copytree

A genericprin

A genericwrite

A Single Precision Integers

A singleprecisioninteger

A singleprecisioninteger

A singleprecisionintegerp

A evenp

A evenp

A oddp

A oddp

A divisionbyzero

A quotient

A quotient

A remainder

A remainder

A modulo

A modulo

A mostpositivesingleprecisioninteger

A mostnegativesingleprecisioninteger

A converter character

A nosuchcharacter

A converter string

A converter doublefloat

A copy

A genericprin

A genericwrite

A Streams

A stream vi

Programming Language EuLisp version

A filestream

A inputstream

A iostream

A ouputstream

A filestreamp

A streamcondition

A syntaxerror

A inputstreamp

A outputstreamp

A iostreamp

A characterstreamp

A binarystreamp

A open

A open

A openp

A openp

A close

A close

A writeunit

A writeunit

A writeunit

A write

A genericwrite

A prin

A genericprin

A readunit

A readunit

A read

A genericread

A genericread

A peekunit

A peekunit

A flush

A flush

A wait

A Strings

A string

A string

A stringp

A stringref

A setter stringref

A converter pair

A equal

A copy

A length

A stringlt

A stringslice

A stringappend

A genericprin

A genericwrite

A Symb ols

A symbol

A symbol

A symbolp

A gensym

A symbolname

A symbolexistsp

A genericprin

A genericwrite

A genericwrite

A Tables

A table

A tablep

A tableref

A setter tableref

A tabledelete

A genericprin

A genericwrite vii

Programming Language EuLisp version

A Vectors

A vector

A vector

A vectorp

A length

A vectorref

A setter vectorref

A makeinitializedvector

A maximumvectorindex

A converter pair

A equal

A copy

A genericprin

A genericwrite

B Programming Language EuLisp Level

B Classes and Ob jects

B defclass

B Generic Functions

B defgeneric

B defmethod

B genericlambda

B genericlabels

B Reection on Ob jects

B classof

B Reection on Classes and Slot Descriptions

B slotdescription

B localslotdescription

B classname

B classprecedencelist

B classslotdescriptions

B classinitargs

B slotdescriptionname

B slotdescriptioninitfunction

B slotdescriptionslotreader

B slotdescriptionslotwriter

B Dening Metaclasses

B defmetaclass

B Initializi ng Classes

B initialize

B Initializi ng Slot Descriptions

B initialize

B Inheritance Proto col

B compatiblesuperclassesp

B compatiblesuperclassesp

B compatiblesuperclassp

B compatiblesuperclassp

B compatiblesuperclassp

B compatiblesuperclassp

B computeclassprecedencelist

B computeclassprecedencelist

B computeslotdescriptions

B computeslotdescriptions

B computeinitargs

B computeinitargs

B computeinheritedslotdescriptions

B computeinheritedslotdescriptions

B computeinheritedinitargs

B computeinheritedinitargs

B computedefinedslotdescription

B computedefinedslotdescription

B computedefinedslotdescriptionclass

B computedefinedslotdescriptionclass

B computespecializedslotdescription

B computespecializedslotdescription

B computespecializedslotdescriptionclass

B computespecializedslotdescriptionclass

B Slot Access Proto col viii

Programming Language EuLisp version

B computeandensureslotaccessors

B computeandensureslotaccessors

B computeslotreader

B computeslotreader

B computeslotwriter

B computeslotwriter

B ensureslotreader

B ensureslotreader

B ensureslotwriter

B ensureslotwriter

B computeprimitivereaderusingslotdescription

B computeprimitivereaderusingslotdescription

B computeprimitivereaderusingclass

B computeprimitivereaderusingclass

B computeprimitivewriterusingslotdescription

B computeprimitivewriterusingslotdescription

B computeprimitivewriterusingclass

B computeprimitivereaderusingclass

B Predicates and Constructors

B computepredicate

B computepredicate

B computeconstructor

B computeconstructor

B Instance Allo cation

B allocate

B allocate

B Low Level Allo cation Primitives

B primitiveallocate

B primitiveclassof

B setter primitiveclassof

B primitiveref

B setter primitiveref

B Reection on Generic Functions and Metho ds

B Introsp ection

B genericfunctionname

B genericfunctiondomain

B genericfunctionrange

B genericfunctionmethodclass

B genericfunctionmethods

B genericfunctionmethodlookupfunction

B genericfunctiondiscriminatingfunction

B methoddomain

B methodrange

B methodfunction

B methodgenericfunction

B Sp ecial forms or macros

B methodfunctionlambda

B callmethod

B applymethod

B Initializi ng Generic Functions and Metho ds

B initialize

B initialize

B Metho d Lo okup and Generic Dispatch

B computemethodlookupfunction

B computemethodlookupfunction

B computediscriminatingfunction

B computediscriminatingfunction

B Extending Generic Functions by New Metho ds

B addmethod

B addmethod

B removemethod

B removemethod

B Dynamic Binding

B dynamic

B dynamicsetq

B unbounddynamicvariable

B dynamiclet

B defvar ix

Programming Language EuLisp version

B dynamicmultiplydefined

B Conditional Extensions

B when

B unless

B Exit Extensions

B block

B returnfrom

B catch

B throw

B Summary of Level Expressions and Denitions

Bibliography

Indexes

Function Index

Macro Index

Generic Function Index

Metho d Index

Condition Index

Constant Index

General Index

Figures

Example of imp ort and exp ort directives

Level initial class hierarchy

State diagram for threads

Level initial condition class hierarchy

A Level numb er class hierarchy and co ercion chart

B Initializati on Call Structure

Tables

Mo dules comprising level

Minimal character set

Mo dule syntax

genericprin output syntax

genericwrite output syntax

defstruct syntax

defclass syntax level

defgeneric syntax level

Quasiquote Syntax

Expressions and Denitions level

A Sp ecial Character Syntax

A Character Syntax

A Metho ds for double precision oats

A Floating Point Syntax x

Programming Language EuLisp version

A expt result classes

A Pair and List Syntax

A Metho ds for single precision integers

A Integer Syntax

A Sign combination in modulo

AInitial stream class hiearchy

AString escap e digrams

AExamples of string literals

AString Syntax

AIdentierSymb ol Syntax

AVector Syntax

B defclass syntax level

B defgeneric syntax level

B Slot Description Metaob ject Classes

B Metaob ject Classes

B Generic Function Metaob ject Classes

B Expressions and Denitions level xi

COMMITTEE DRAFT Programming Language EuLisp version

Programming Language EuLisp version

they started and the authors would like to thank all those

who have help ed in the development of EULISP

Initially funding for the EULISP group came from individ u

als institutions or companies but since the Commis

sion of the Europ ean Communities CEC as the EULISP

Technical Interest Group TIG also called the EULISP

committee supp orted by DG XI I I has provided the as

sistance without which this eort would have faded away

In addition the EULISP group is grateful for the sup

p ort of British Council in France Alliance programme

British Council in Spain Acciones Integradas programme

British Council in Germany Academic Research Collab

oration programme British Standards Institute Centre

dEstudis Avancats de Blanes CSIC Departament de Llen

guatges i Sistemes Informatics LSI Universitat Politecnica

Foreword

de Catalunya Gesellschaft fur Mathematik und Datenver

arb eitung GMD ILOG SA Insiders GmbH Institut Na

The EULISP group rst met in Septemb er at IRCAM in

tional de Recherche en Informatique et en Automatique IN

Paris to discuss the need for a common Europ ean dialect of

RIA Institut de Recherche et de Co ordination Acoustique

Lisp Subsequent meetings formulated the view of EULISP

Musique IRCAM Rank Xerox France Science and Engi

that was presented at the ACM Conference on Lisp

neering Research Council Siemens AG University of Bath

and held at MIT Cambridge Mas

University of Technology Delft University of Edinburgh

sachussetts Padget et al and at the Europ ean Confer

Universitat Erlangen Universite Paris VI LITP

ence on Articial Intelligence ECAI held in Brighton

Sussex Stoyan et al Since then progress has not

The following p eople in alphab etical order have con

b een steady but happ ening as various p eople had sucient

tributed in various ways to the evolution of the language

time and energy to develop part of the language Conse

Giusepp e Attardi Javier Bejar Russell Bradford Harry

quently although the vision of the language has in the most

Bretthauer Peter Broadb ery Christopher Burdorf Jerome

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

Chailloux Thomas Christaller Je Dalton Klaus Daler

turned into physical descriptions and implementation s For

Harley Davis David DeRoure John Fitch Richard Gabriel

a nine month p erio d starting in January through the

Brigitte Glas Nicolas Graub e Dieter Kolb Jurgen Kopp

supp ort of INRIA it b ecame p ossible to start writing this

Pascal Kuczynski Antonio Moreno Eugen Neidl Pierre Par

do cument the EULISP denition Since then aairs have

quier Keith Playford Willem van der Po el Christian Quein

returned to their previous state but with the evolution of

nec Enric Sesa Herb ert Stoyan and Richard Tobin

the implementations of EULISP and the background of the

foundations laid by the INRIA supp orted work there is con

The editors wish particularly to acknowledge the work of

vergence to a consistent and practical denition

Harley Davis on the rst version of the description of the

ob ject system and of Harry Bretthauer on the second version

The acknowledgements for this rep ort fall into three cate

gories intellectual p ersonal and nancial

Julian Padget japmathsbathacuk

Scho ol of Mathematical Sciences

The ancestors of EULISP in alphab etical order are Com

University of Bath

mon LispSteele InterLISPTeitelman LE

Bath Avon BA AY UK

LISP Chailloux et al LISPVM Alb erga et al

Scheme Clinger Rees and Rees et al

Slade There has also b een some feedback from a lan

Greg Nuyens nuyensilogfr

guage which has b een inuenced by EuLisp namely Dylan

ILOG SA

Shalit Thus the authors of this rep ort are pleased to

Avenue Gallieni

acknowledge b oth the authors of the manuals and denitions

Gentilly CEDEX FRANCE

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

extended those languages in individ ual pap ers The various

pap ers on Standard ML Milner et al and the draft

rep ort on Haskell Hudak Wadler et al have also pro

editors

vided much useful input

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

p orted by Bull SA Ecole Polytechnique LIX ILOG SA

Institut National de Recherche en Informatique et en Au

tomatique INRIA University of Bath and Universite Paris

VI LITP The authors gratefully acknowledge this sup

p ort Many p eople from Europ ean Community countries

have attended and contributed to EULISP meetings since

Programming Language EuLisp version

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 Bo

brow et al Ob jVLisp Cointe Oaklisp Lang

Pearlmutter and MicroCeyx Chailloux et al

The greatest debt of TELOS is to CLOS from which it takes

the ideas of generic functions and multimetho ds In addi

tion most of the terminology the names and format of the

userlevel macros and the names of many of the functions in

the internal proto col are inspired by CLOS From Ob jVLisp

TELOS takes the principle of a reective architecture which

emphasizes the p ower of metaclasses as an implementation

strategy From Oaklisp TELOS takes the idea of anonymous

classes Finally from MicroCeyx TELOS takes the idea of

a small highly ecient kernel tightly integrated with the

Intro duction

rest of the language In TELOS this integration is achieved

through the total merging of typ es with classes and message

The purp ose of this do cument is to dene the programming

passing through normal function application Classes are

language EULISP EULISP is a dialect of Lisp and as such

rstclass values The class structure integrates the primitive

owes much to the great b o dy of work that has b een done

classes describing fundamental datatyp es the dened classes

on language design in the name of Lisp over the last thirty

and userdened classes The function classof given an

years EULISP is the outcome of eorts on the part of many

ob ject returns the class of which it is a direct instance

p eople in countries of the Europ ean Community since

The guiding principles of the language are simplici ty expres

Mo dules and classes are the buildin g blo cks of b oth the

siveness completeness orthogonality of constructs formal

EULISP language and of application s written in EULISP The

denition and ecient implementation

mo dule system exists to limit access to items by name That

is mo dules allow for hidden denitions Each mo dule denes

EULISP do es not claim any particular Lisp dialect as its

a fresh empty lexical environment This fresh environment

closest relative although parts of it were inuenced by fea

is the toplexical environment of that mo dule A dening

tures found in Common Lisp InterLISP LELISP LISPVM

form creates a new binding in the top lexical environment of

Scheme and T

the lexical environment in which it is evaluated

EULISP b oth intro duces new ideas and takes from these

Continuations are rstclass in EULISP but they are not as

Lisps It also extends or simplies their ideas as necessary

general as in Scheme They are weaker b ecause they can

It takes a class system but extends the notion by integrat

only b e used within the dynamic extent of their creation

ing the primitive typ es classes with userdened classes

That also implies they can only b e used once These weaker

It has a condition system It intro duces a mo dule mecha

continuations are suitable for controlling simple nonlo cal

nism for information hiding and separate compilation and it

exits and form the basis of the condition system of hand lers

has rstclass continuations But this is not the place for a

Functions to o are rstclass comprising the environment

detailed language comparison That can b e drawn from the

of denition the closure of the denition and an expression

rest of this rep ort However it is imp ortant to stress that the

as describ ed by Landin in ISWIM Landin

distinguishi ng features of EULISP are the integration of the

classical Lisp typ e system and the ob ject system into a sin

Dynamically scop ed bindings can b e created in EULISP but

gle class hierarchy the complementary abstraction facilities

their use is much more restricted than in most Lisps up to

provided by the class and the mo dule mechanism and su

nowexcept Scheme EULISP enforces a strong distinction

p ort for concurrent execution EULISP inherits from Scheme

b etween lexical bindings and dynamic bindings by requir

the prop erties of staticscoping a single lexical environment

ing the use of a sp ecial form called dynamiclet for their

for all variables and the uniform treatment of op erator and

creation and two other sp ecial forms called dynamic and

op erands

dynamicsetq for access and up date resp ectively

NOTE version Changes b etween this version and

are further improvements to the parallel pro cessing mo del and

Multiple control threads can b e created in EULISP and or

the addition and revision of some of the thread op erations a ma

derly access to data shared b etween more than one control

jor rewrite of inputoutput functions and the asso ciated stream

thread can b e mediated by means of semaphores

classes a ma jor rewrite of telos to account for the revised meta

ob ject proto col a ma jor reorganisation of the do cument to reect

b etter the structure of the language and hop efully to make it

Language Structure

easier to grasp the essentials of the design on rst reading

The EULISP denition comprises the following items

Overview

Level comprises all the level functions macros

and sp ecial forms which is this do cument minus annex B

The op erator and the op erands of forms are treated in a uni

The class system can b e extended by userdened struc

form manner Here EULISP continues the tradition exempli

ture classes and generic functions

ed in Scheme T LISPVM and Cambridge LISP Fitch

Norman In common with other LISPlike languages

function parameters are passed by value and in common Level extends level with the functions macros

with Scheme and some other Lisps functions themselves are and sp ecial forms dened in annex B The class system

rstclass values can b e extended by userdened classes and metaclasses

Programming Language EuLisp version

The implementation of level is not necessarily written or b The minimal requirements of a conguration that is

writable as a conforming level program capable of supp orting an implementation of an EULISP

pro cessor

Level is yet to b e elab orated

c The metho d of preparation of an EULISP program for

execution or the metho d of activation of this EULISP pro

A level function is a generic function dened by this re

gram once prepared

p ort to b e part of a conforming pro cessor for level A func

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

d The metho d of rep orting errors warnings or excep

level application Note that apart from new sp ecial forms

tions

the functionality for all level functions can b e dened in

terms of level op erations Thus any level function is a

e The typ ographical representation of an EULISP pro

level application The same constructive denition applies

gram for human reading

to level functions b eing level applications

To clarify certain instances of the use of English in this do c

Much of the functionality of EULISP is dened in terms of

ument the following denitions are provided

mo dules These mo dules might b e available and used at

any level but certain mo dules are required at certain levels

must a verbal form used to intro duce a required prop

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

erty All conforming pro cessors must satisfy the prop erty

given level that dep endency will b e sp ecied

should A verbal form used to intro duce a strongly rec

The main part of this do cument denes the kernel of level

ommended prop erty Implementers of pro cessors are urged

of EuLisp The annex A denes all the remaining classes and

but not required to satisfy the prop erty

mo dules which comprise level The dened name of the

mo dule providing level of EuLisp is level which

imp orts and reexp orts the mo dules sp ecied in Table

Normative References

Table Mo dules comprising level

The following standards contain provisions which through

references in this do cument constitute provisions of this def

Mo dule Section

inition At the time of writing the editions indicated were

character A

valid All standards are sub ject to revision and parties mak

collection A

ing use of this denition are encouraged to apply the most

compare A

recent edition of the standard listed b elow

convert A

copy A

ISO Information processing ISO bit coded char

double A

acter set for information interchange Note this stan

elementaryfunctions A

dard is currently under revision and interested parties should

formattedio A

reference the Draft International Standard version of

null A

ISOIEC

number A

pair A

ISO Data processing vocabulary

semaphore

spint A

ISO TR Information technology Guide

stream A

lines for the preparation of conformity clauses in program

string A

ming language standards

symbol A

table A

ISO TR Information technology Guide

thread

lines for the preparation of programming language standards

vector A

Note this is currently a draft technical report

BS Method of dening Syntactic metalanguage

Level of EuLisp is dened in annex B

Conformance Denitions

Scop e

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

This do cument sp ecies the syntax and semantics of the

to the denition of any programming language They are

computer programming language EULISP by dening the re

derived from ISOIEC TR

quirements for a conforming EULISP pro cessor and a con

forming EULISP program the textual represenation of data

and algorithms

conguration Host and target computers any op

erating systemss and software runtime system used to

This do cument do es not sp ecify

op erate a language processor

a The size or complexity of an EULISP program that

will exceed the capacity of any sp ecic conguration or conformity clause Statement that is not part of

pro cessor nor the actions to b e taken when those limits the language denition but that sp ecies requirements for

are exceeded compliance with the language standard

Programming Language EuLisp version

conforming program Program which is written in NOTE The violation of the syntatic or static semantic re

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

the language dened by the language standard and which

program p erforming the analysis of the EULISP program

ob eys all the conformity clauses for programs in the language

standard

All errors sp ecied in this denition are dynamic unless ex

plicitly stated otherwise

conforming pro cessor Processor which pro cesses

conforming programs and program units and which ob eys all

the conformity clauses for processors in the language stan

Compliance

dard

An EULISP pro cessor can conform at any of the three levels

dened under Language Structure in the Intro duction Thus

error Incorrect program construct or incorrect

a level conforming pro cessor must supp ort all the basic

functioning of a program as dened by the language stan

expressions classes and class op erations dened at level

dard

A level conforming pro cessor must supp ort all the basic

expressions classes class op erations and mo dules dened at

level A level conforming pro cessor must supp ort all the

extension Facility in the processor that is not sp ec

classes class op erations and all of the mo dules dened at

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

level

ambiguity or contradiction when added to the language stan

dard

The following two rules govern the conformance of a pro ces

sor at a given level

implementationdened Sp ecic to the proces

a A conforming processor must correctly pro cess all pro

sor but required by the language standard to b e dened

grams conforming b oth to the standard at the sp ecied

and do cumented by the implementer

level and the implementationdened features of the pro

cessor

pro cessor translator or interpreter work

ing in combination with a conguration

b A conforming processor should oer a facility to rep ort

the use of an extension which is statically determinable

solely from insp ection of a program without execution

It is also considered desirable that a facility to rep ort the

Error Denitions

use of an extension which is only determinable dynamically

b e oered

Errors in the languge describ ed in this denition fall into one

of the following three classes

A level conforming program is one which observes the syn

tax and semantics dened for level A level conforming

program might not conform at level A strictlyconforming

dynamic error An error which is detected during

level program is one that also conforms at level A level

the execution of an EULISP program or which is a violation

conforming program observes the syntax and semantics

of the dynamic semantics of EULISP Dynamic errors have

dened for level A level conforming program is also a

two classication s

level conforming program Hence by extension a level

strictlyconforming program is also a level conforming

a Where a conforming processor is required to detect

program

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

signied by the phrase an error is signaled The condition

In addition a conforming program at any level must not use

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

any extensions implemented by a language processor but it

sists of identifying the condition class related to the error

can rely on implementationdened features

and allo cating an instance of it This instance is initial

ized with information dep endent on the condition class A

The do cumentation of a conforming processor must include

conforming EULISP program can rely on the fact that this

condition will b e signaled

a A list of all the implementationdened denitions or

values

b Where a conforming processor might or might not de

tect and rep ort up on the error This is signied by the

b A list of all the features of the language standard

phrase is an error Such errors should b e detected and

which are dep endent on the processor and not imple

rep orted

mented by this processor due to nonsupp ort of a partic

ular facility where such nonsupp ort is p ermitted by the

standard

environmental error An error which is detected

by the conguration supp orting the EULISP pro cessor The

c A list of all the features of the language implemented

pro cessor must signal the corresp onding dynamic error which

by this processor which are extensions to the standard lan

is identied and handled as describ ed ab ove

guage

d A statement of conformity giving the complete ref

static error An error which is detected during the

erence of the language standard with which conformity

preparation of a EULISP program for execution such as a

is claimed and if appropriate the level of the language

violation of the syntax or static semantics of EULISP by the

supp orted by this pro cessor

EULISP program under preparation

Programming Language EuLisp version

Conventions this case any new metho ds must resp ect the domain andor

range of the generic function to which they are to b e at

tached The use of a classdescriptive name in the context

This section denes the conventions employed in this do cu

of a generic function denition denes the intention of the

ment how denitions will b e will b e laid out the typ eface

denition and is not necessarily a p oliced restriction

to b e used the metalanguage used in descriptions and the

naming conventions A later section contains denitions

If it is required to indicate rep etition the notation

of the terms used in this do cument

+

expression and expression will b e used for zero or more

and one or more o ccurrences resp ectively The arguments in

Layout and Typ ography

some function descriptions are enclosed in square brackets

graphic representation and This indicates that the

Both layout and fonts are used to help in the description

argument is optional The accompanying text will explain

of EULISP A language element is dened with its name as

what default values are used

the heading of a clause coupled with its classicatio n for

example

The resultclass of an op eration except in one case refers

specialformname special form

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

functionname function

The exception is for predicates Predicates are dened to

genericfunctionname generic

return either the empty listwritten representing the

genericfunctionname method

b o olean value false or any value other than representing

conditionname super condition

true Although the class containing this set of values is not

dened in the language notation is abused for convenience

Thus a sample entry might app ear as

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

samplefunction function

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

it is sp ecied precisely in the description of the function

Arguments

arg An instance of class x

1

Naming

arg An instance of class x

2

Naming conventions are applied in the descriptions of prim

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

arg An optional argument of class x

3

function names Here is a list of the conventions and some

examples of their use

Result

The result class

name wrapping By convention the initial

bindings of classes have names which b egin with and

end with

Remarks

Some clarifying background to the actions of the function

binary prex The two argument version of a n

ary argument function There is not always a corresp ondence

Examples

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

Some examples of calling the function with certain argu

example binaryplus is the two argument generic function

ments and the result that should b e returned

corresp onding to the nary argument function

See also Cross references to other sections or to

class sux The name of a metaclass of a set of

other individu al relevant language elements

related classes For example functionclass which is the

metaclass of function genericfunction and any of their

sub classes and conditionclass is the class of all conditions

Metalanguage

The exception is class itself which is the default metaclass

The prex should describ e the general domain of the classes

The terms used in the following descriptions are dened in

in question but not necessarily any particular class in the

section

set

A standard function denotes a immutable mo dule binding of

the dened name All the denitions in this do cument are

generic prex The generic version of the func

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

tion named by the stem

tors which have no bindings anywhere All bindings and all

the sp ecial form op erators can b e renamed

hyphenation Function and class names made up

Frequently a classdescriptive name will b e used in the ar

of more than one word are hyphenated for example

gument list of a function description to indicate a restriction

computeprimitivereaderusingslotdescription

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

of a function it is an error to call it with a value outside

the sp ecied domain In the case of a generic function the p sux A predicate function is named by a p

domain can b e widened arbitrarily by the denition of new sux if the function or class name is not hyphenated for

metho ds similarly the range except when the generic func instance consp and is named by a p sux if it is for

tion was dened with a particular domain andor range In instance compatiblesuperclassp

Programming Language EuLisp version

ref sux For each builtin or dened class list are determined by the class of the class through methods

there is a eld accessor named classnamerefwhere of the generic function computeclassprecedencelist

appropriateand a corresp onding eld up dator setter

classnamerefalso where appropriate for example

class option A keyword and its asso ciated value

tableref This convention is broken by historical prece

applying to a class app earing in a class denition form for

dent for the accessors to slots of pairs which are called car

example the predicate keyword and its value which denes

and cdr

a predicate function for the class b eing dened

Denitions

closure The closure of an expression E is the set

of all free variables that o ccur in E

This set of denitions which will b e used throughout this

do cument is selfconsistent but might not agree with notions

congruent A constraint on the form of the

accepted in other language denitions The terms are dened

in alphab etical rather than dep endency order and where a lamb dalist of a metho d which requires it to have the same

numb er of elements as the generic function to which it is to

denition uses a term dened elsewhere in this section it

is written in italics Some of the terms dened here are b e attached

redundant Names in courier font refer to entities dened

in the language

constant A numb er string character or the

empty list

accessor An accessor is a asso ciation of a reader and

a writer

constructor A constructor is a function which

creates an instance of a particular class

applicable metho d A method is applicabl e for a

particular set of arguments if each element in its signature is

continuation A continuation is a function of one

a superclass of the class of the corresp onding argument

parameter which represents the rest of the program For ev

ery p oint in a program there is the remainder of the program

applicable metho d list An applicable metho d list

coming after that p oint This can b e viewed as a function

is a list of all the methods applicabl e for a particular list of

of one argument awaiting the result of that p oint Such a

arguments to a generic function sorted according to method

function is called a continuation

signature sp ecicity

converter function The generic function asso ci

applicable ob ject An applicabl e ob ject is an in

ated with a class the target that is used to pro ject an in

stance of function

stance of another class the source to an instance of the

target

binding A lo cation containing a value

dening form Any form or any macro ex

pression expanding into a form whose op erator is one

binding form Any form or any macro expression

of defclass defcondition defconstant defgeneric

expanding into a form which causes the creation of inner

deflocal defmacro defmetaclass defstruct defun

dynamic or inner lexical bindings

defvar

b ound variable A variable x is b ound in an ex

direct instance A direct instance of a class class

1

pression E if x o ccurs in the scope of a dening form which

is any object whose class is class

1

creates innerlexical bindings or of a binding form o ccurring

in E whose variable binding list contains x

direct slot description A classs direct slot de

scriptions are dened sp ecically for the class

class A class is an object which describ es the struc

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

A class ob ject contains inheritance information and a set of

direct sub class A class is a direct subclass of

1

slot descriptions which dene the structure of its instances

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

2 1 2 1

A class object is an instance of a metaclass All classes in

to class and there is no other class which is a superclass

2 3

EULISP are subclasses of object and all instances of class

of class and a subclass of class

1 2

are classes

direct sup erclass A direct superclass of a class

class precedence list Each class has a linearized

class is any class for which class is a direct subclass

1 1

list of all its superclasses direct and indirect b eginning

with the class itself and ending with the ro ot of the in

discrimination Generic function applicatio n con heritance graph the class object This list determines

sists of two parts nding a set of methods applicabl e to the the sp ecicity of slot and metho d inheritance A classs

given set of arguments and application of the method func class precedence list may b e accessed through the function

tions of those methods The rst part is called discrimination classprecedencelist The rules used to compute this

Programming Language EuLisp version

or method lookup Generic functions have an asso ciated func indenite scop e An access constraint such that

tion called the discriminating function which implements the the scope of the variable is unlimited

discriminatio n Users can dene new classes of generic func

tions which implement discrimination in new ways

indirect instance A indirect instance of a class

class is any object whose class is a subclass of class

1 1

dynamic environment The inner and top dy

namic environment taken together are referred to as the

indirect slot description A slot description is in

dynamic environment

direct for a class if the slot description is dened for class

1 1

but was originally dened for another class which is a su

2

perclass of class and incorp orated into class through inher

1 1

dynamic extent A lifetime constraint such that

itance An indirect slot description is also called an inherited

the entity is created on control entering an expression and

slot description

destroyed when control exits the expression Thus the entity

only exists for the time b etween control entering and exiting

the expression

indirect sub class A class is an indirect sub class

1

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

2 1 2 1

to class and there is at least one other class which is a

2 3

dynamic scop e An access constraint such that

superclass of class and a subclass of class

1 2

the scope of the entity is limited to the dynamic extent of

the expression that created the entity

inheritance graph A directed lab elled acyclic

graph whose no des are classes and whose edges are dened

dynamically closer If a form F is executed in

by the subclass relations b etween the no des This graph has

the dynamic extent of a form F then within the dynamic

a distinguis hed ro ot the class object which is a superclass

extent of F F is dynamicall y closer than F

of every class

extent That lifetime for which an entity exists

inherited slot description See indirect slot de

Extent is constrained to b e either dynamic or indenite

scription

form One of constant symbol literal function call

initarg A symbol used as a keyword in an initlist

or special form

to mark the value of some slot Used in conjunction with

make and the other object initiali zati on functions to sp ecify

initial slot values An initarg may b e declared for a slot in a

free variable A variable x is free in an expression

class denition form using the initarg slot option

E if x do es not o ccur in the lexical scope of any dening which

creates innerlexical bindings or any binding form o ccurring

in E whose variable binding list contains x

initform A form which is evaluated to pro duce a

default initial slot value Initforms are closed in their lexi

cal environments and the resulting closure is called an init

function A function comprises at least an expres

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

sion a set of identiers which o ccur in the expression called

denition form using the initform slot option

the parameters and the closure of the expression with re

sp ect to the lexical environment in which it o ccurs less the

parameter identiers Note this is not a denition of the

initfunction A function of no arguments whose

class function

result is used as the default value of a slot Initfunctions

capture the lexical environment of an initform declaration in

a class denition form

generic function Generic functions are functions

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

arguments A generic function is dened in terms of methods

initlist A list of alternating keywords and values

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

which describ es some notyet instantiated ob ject Generally

set of argument classes called the metho ds signature

the keywords corresp ond to the initargs of some slot descrip

tion of some class

identier An identier is the syntactic represen

tation of a variable

inner dynamic Inner dynamic bindings are cre

ated by dynamiclet referenced by dynamic and mo died

by dynamicsetq Inner dynamic bindings extendand can

improp er list An improp er list is a list whose

shadowthe dynamicall y enclosing dynamic environment

nal pair contains something other than the empty list in its

cdr eld

inner lexical Inner lexical bindings are created by

lambda and letcc referenced by variables and mo died by

indenite extent A lifetime constraint such that setq Inner lexical bindings extendand can shadowthe

the entity exists for ever In practice this means for as long lexically enclosing lexical environment Note that letcc

as the entity is accessible creates an immutable binding

Programming Language EuLisp version

instance Every object is the instance of some metho d lo okup See discrimination

class An instance thus describ es an object in relation to

its class An instance takes on the structure and b ehavior

metho d sp ecicity A signature signature is

1

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

more sp ecic than another signature if the rst class in

2

indirect

signature is a subclass of the rst class in signature or

1 2

if they are the same the rest of signature is more sp ecic

1

instantiation graph A directed graph whose

than the rest of signature

2

no des are objects and whose edges are dened by the in

stance relations b etween the objects This graph has only

multimetho d A method which sp ecializes on all

one cycle an edge from class to itself The instantation

its arguments All metho ds in this denition are multi

graph is a tree and class is the ro ot

metho ds

lexically closer If a form F o ccurs in a form F

new instance A newly allo cated instance which

then any bindings created by F are lexically closer than

is distinct but can b e isomorphic to other instances

those of F

ob ject Any entity that can b e b ound to a

lexical environment The inner and top lexical

variableincluding entities from outside LISPs memory Ev

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

ery ob ject is an instance of some class

ical environment except when it is necessary to distinguish

b etween them

prop er list A prop er list is a list whose nal pair

contains the empty list in its cdr eld or is just the empty

lexical scop e An access constraint such that the

list

scope of the entity is limited to the textual region of the form

creating the entity See also lexical ly closer and shadow

reader A reader is a function of one argument

which returns the value of a particular slot in instances of a

literal An ob ject created by use of the quote op

particular class

erator

macro A macro is a function A macro is distin

reective A system which can examine and mo d

guished from a function by when it is used macro functions

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

are only used during the syntax expansion of mo dules to

the extent that it has explicit class ob jects and metaclasses

transform expressions

and userextensible op erations up on them

macro expression A form whose op erator names

scop e That part of the extent in which a given

a macro expansion function

variable is accessible Scop e is constrained to b e lexical dy

namic or indenite

metaclass A metaclass is a class object whose in

stances are themselves classes All metaclasses in EULISP are

selfinstantiated class A class which is an in

instances of class which is an instance of itself All meta

stance of itself In EULISP class is the only example of

classes are also subclasses of class class is a metaclass

a selfinstantiated class

metho d A metho d describ es the action of a

setter function The function asso ciated with the

generic function for a particular list of argument classes

function that accesses a place in an entity which changes the

called the metho ds signature A method is thus said to add

value stored that place

to the b ehavior of each of the classes in its signature Meth

o ds are not functions but objects which contain among other

shadow If two entities are created for which the

information a function representing the metho ds b ehavior

same means of reference is used and either the form creating

one o ccurs lexically in the form creating the other where the

metho dcombination The applicabl e metho d

means of reference has lexical scope or the form creating one

list for an argument list determines the next method called

is executed in the dynamic extent of the form creating the

by the sp ecial form callnextmethod for any method in

other where the means of reference has dynamic scope then

the list the next method is simply the method following it in

the outer entity is shadowed by the inner one

the list

signature A signature is a list of classes derived

metho d function A function which implements

from a list of arguments or the list of classes for which a

the b ehavior of a particular method Metho d functions have

method is applicable

sp ecial restrictions which do not apply to all functions their

formal parameter bindings are immutable and the sp ecial

slot A named comp onent of an object which can forms callnextmethod and nextmethodp are only valid

b e accessed using the slots accessor Each slot of an object within the lexical scop e of a metho d function

Programming Language EuLisp version

is describ ed by a slot description object asso ciated with the All these bindings are immutable deflocal creates a muta

class of the object When we refer to the structure of an ble toplexical binding All such bindings are referenced by

object this usually means its set of slots variables and those made by deflocal are mo died by setq

Each mo dule denes its own distinct top lexical environment

slot description A slot description object de

variable A variable denotes a binding and is a

scrib es a slot in the instances of a class This descrip

means to reference the value stored in the binding

tion includes the slots name its logical p osition in in

stances and a way to determine its default value A

classs slot descriptions may b e accessed through the func

writer A writer is a function of two arguments

tion classslotdescriptions A slot description can b e

which changes the value of a particular slot in instances of a

either direct or indirect

particular class

slot option A keyword 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

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

any form which must b e evaluated in a sp ecic way

sp ecialize A verbal form used to describ e the cre

ation of a more sp ecic version of some entity Normally

applied to classes slotdescription s and metho ds

sp ecialize on A verbal form used to describ e re

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

natures

sub class The b ehavior and structure dened by a

class class are inherited by a set of classes which are termed

1

subclasses of class A subclass can b e either direct or indi

1

rect

sup erclass A class is a sup erclass of class i

1 2

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

2 1

direct or indirect

symb ol A symb ol is a data structure often used

to represent an identier

textual slot description A list of alternating

keywords and values starting with a keyword which rep

resents a notyetcreated slot description during class initial

isation

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 environ

ment of a mo dule by defclass defcondition defconstant

defgeneric defmacro defmetaclassdefstruct and defun

Programming Language EuLisp version

Mo dules Syntax

Case is distinguish ed in each of characters strings and iden

The EULISP mo dule scheme has several inuences the exist

tiers so that variablename and Variablename are dif

ing LeLisp implementation the mo del dened in the func

ferent but where a character is used in a p ositional numb er

tional language Haskell the ML mo dule system MacQueen

representation eg xAd the case is ignored Thus case

the makeenvironment mo dule mechanism used in C

is also signicant in this do cument and as will b e observed

Scheme and Ts locales

later all the sp ecial form and standard function names are

lower case In this section and throughout this do cument

The mo dule mechanism provides a means of abstraction and

the names for individu al character glyphs are those used in

a means of security for programs in a complementary style to

ISOIEC DIS

that provided by the ob ject system Indeed although ob jects

do supp ort data abstraction they do not supp ort all forms

The minimal character set to supp ort EULISP is dened in

of information hiding For this reason it is imp ortant to

Table The language as dened in this do cument uses

provide a mechanism oering the complete hiding of names

only the characters given in this table Thus left hand sides

A mo dule denes a mapping b etween a set of names and the

of the pro ductions in this table dene and name groups of

bindings of those names in the imp orted mo dule Most such

characters which are used later in this denition digit upper

bindings are immutable The exception are those bindings

lower other special and alphabetic

created by deflocal which may b e mo died by the dening

and imp orting mo dules There are no implicit imp orts into

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

a mo dule and not even the sp ecial forms are available in a

EULISP is dened in the section of this do cument corresp ond

mo dule that imp orts nothing A mo dule exp orts nothing by

ing to the class characterA doublefloat

default

nullA pairA spintA

stringA symbolA and vectorA The

A mo dule denition creates two new empty lexical

syntax for identiers corresp onds to that for symb ols

environmentsthe internal and the external toplexical en

vironments of the mo dule All the bindings in the mo dule

b o dy are stored in the internal toplexical along with those

Whitespace and Comments

bindings shared by imp ortation with other mo dules The

external toplexical shares those bindings from the internal

Whitespace characters are space and newline The newline

toplexical that are exp orted and also those of all the exp osed

character is also used to represent end of record for congu

mo dules mo dules which are exp orted but not imp orted

rations providing such an input mo del thus a reference to

The names of mo dules are b ound in a disjoint binding en

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

vironment which is only accessible via the mo dule denition

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

form That is to say mo dules are not rstclass The rep

the legibil ity of programs for human readers Whitespace

resentation of the mo dule environment is implementation

separates tokens and is only signicant in a string or when

dened The b o dy of a mo dule denition comprises an im

it o ccurs escap ed within an identier

p ort directive followed by a syntax directive and a sequence

of denitions expressions and exp ort directives The pro

A comment is intro duced by the commentbegin glyph called

cessing of each of these is now discussed in detail

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

Imp orts

the newline Thus a comment is equivalent to whitespace

The imp ort directive is expressed in terms of mo dule names

and the lters except only and rename The syntax of

imp ort sp ecications is given in Table An importspec

is a sequence of modulenames and or moduledirectives and

denotes the union of all the names generated by each element

of the sequence

In pro cessing imp ort directives every name should b e

thought of as a pair of modulename localname coupled

with some attributes mutable immutable syntax value

Intuitively a namelist of mo dulenamelo cal name pairs is

generated by giving the mo dule name and then ltered by

except only and rename In addition all names with a

syntax attribute are ltered out b ecause syntax functions

can have no use at execution time In an imp ort directive

when a namelist has b een ltered the names are regarded as

b eing dened in the internal toplexical environment of the

mo dule into which they have b een imp orted Should any two

instances of localname have dierent modulenames then

there is a name clash which is a static error Elements of an

importspec are interpreted as follows

except Filters the names from each moduledirective

discarding those sp ecied and keeping all other names

The except directive is convenient when almost all of the

Programming Language EuLisp version

Table Minimal character set

digit j j j j j j j j j

upper A j B j C j D j E j F j G j H j I j J j K j L j M j N j O j P j

Q j R j S j T j U j V j W j X j Y j Z

lower a j b j c j d j e j f j g j h j i j j j k j l j m j n j o j p j

q j r j s j t j u j v j w j x j y j z

other j j j j j j j j j j j j j j j j j j j j j

special j j j j j j j j j

alert j backspace j delete j formfeed j linefeed j new line j return j space j tab j verticaltab

alphabetic upper j lower

names exp orted by a mo dule are required since it is only c If the identier names a sp ecial form then the form

necessary to name those few that are not wanted to ex sp ecic expansion function is invoked

clude them

d If the form is a list the expansion pro cess is applied

modulename All the exp orted names from module

to the op erator and the op erands of the form The result

name

is a form containing the results of the expansion of the

op erator and the op erands in the order corresp onding to

only Filters the names from each moduledirective

the order of the op erator and the op erands in the original

keeping only those names sp ecied and discarding all other

form The expansion pro cess is applied to the resulting

names The only directive is convenient when only a few

form

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

necessary to name those that are wanted to include them

The result of each step of the expansion pro cess is a form

containing references to the bindings visible from the mo dule

rename Filters the names from each moduledirective

in which the expansion function is dened

replacing those with oldname by newname Any name

not mentioned in the replacement list is passed unchanged

Note that once a name has b een replaced the newname

is not compared against the replacement list again Thus

Exp orts

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

directive In consequence name exchanges are p ossible

The exp ort directive is expressed either in terms of bindings

names using export or exportsyntax or mo dule names

using expose The syntax of exp ort sp ecications is given

Syntax

in Table

The syntax section denes the expansion functions for the

Pro cessing exp ort directives employs the same mo del as for

b o dy of the mo dule This section comprises an imp ort di

imp orts namely a mo dulenamelo cal name pair with the

rective for access to expanders dened in other mo dules and

same ltering op erations When the namelist has b een l

a sequence of denitions The imp ort directive is pro cessed

tered the names are added to the set of exp ortations of this

as describ ed ab ove except that all names which do not have

mo dule It is the union of all the exp ort directives in the

a syntax attribute are ltered out The b o dy of the syntax

b o dy of a mo dule denes the externally visible toplexical

section is expanded according to the syntax environment de

environment of the mo dule Should any two instances of

ned by the imp ort directive of the syntax section All the

localname have dierent modulenames then there is a name

resulting functions are added to the syntax environment and

clash which is a static error Note that the external top

the b o dy of the mo dule is then expanded according to that

lexical environment might not b e a subset of the internal

environment

toplexical environment b ecause the external one can refer

ence mo dules which have not b een imp orted

NOTE version Currently the semantics of syntax expan

sion are unsatisfactory b ecause expanders are not opaque to the

The sequence of exportspecs in the mo dule b o dy is treated

user That is to say the resulting expansion can contain references

to bindings imp orted into the syntax mo dule and those mo dules

as the union of all the names generated by each exportspec

must also b e imp orted explicitly by the user of the macro using the

It is a static error if any name o ccurs more than once Each

same binding renamings as the syntax mo dule Neither is there a

exportspec is interpreted as follows

requirement for hygienic expansion so expander and user b ound

variables may interfere with one another It is intended that the

export Each of the names app earing in the export

next version of this do cument should sp ecify a syntax expansion

form is added to the external toplexical environment of

scheme that is opaque to the user

the mo dule

The basic expansion mechanism examines each form in the

mo dule b o dy applying the following pro cess

exportsyntax Each of the names app earing in the

export form is added to the external toplexical environ

a If the form is not a list the result is the original form

ment of the mo dule with the syntax attribute set

b If the form is a list and the op erator is an identier

expose Pro cesses each of the moduledirectives app ear

which is b ound in the syntax environment then the asso

ing in the expose form following the rules for importspec

ciated expansion function is called on a list of the un

and adds the resulting set of names to the external top

evaluated op erands of the form The expansion pro cess

lexical environment of the mo dule

is applied to the resulting form

Programming Language EuLisp version

Figure Example of imp ort and exp ort directives

defmodule example

module import everything from module

except functiona module al l but functiona from module

only functionb module but just functionb from module

rename functionc functiond exchange the names of the bindings of functionc and

functiond

functiond functionc module from module

syntax

syntaxmodule al l of the module syntaxmodule

rename syntaxa syntaxb syntaxmodule rename the binding of syntaxa from syntaxmodule to

syntaxb

rename syntaxc syntaxa syntaxmodule now rename syntaxc from syntaxmodule as syntaxa

expose module export al l of module

except functione module export al l of module except functione

export localdefinition but just three bindngs from this module

localdefinition

localdefinition

Denitions and Expressions cording to the op erators dened in the syntax environment

constructed from the syntax imp ort directive and the lo cal

denitions

Denitions in a mo dule only contain unqualied names

that is localnames using the ab ove terminology All top

lexical mo dule bindings are only ever created once and are

Environment Construction All the dened variables

shared with all mo dules that imp ort the mo dule creating the

are collected and added to the mo dules toplexical en

bindings Only toplexical bindings created by deflocal are

vironment

mutable and it is an error to mo dify an immutable bind

ing Expressions that is nondening forms are collected

Exp ort Pro cessing The exp ortations are collected and

and evaluated in order of app earance at the end of the mo d

the set of exp orted names is constructed

ule denition pro cess when the toplexical environment is

complete The exception to this is the progn form which is

Static Analysis The expanded b o dy of the mo dule is

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

analysed It is a static error if a variable in the b o dy do es

were not present

not have a binding in the toplexical environment

Initializati on The mo dule is initiali zed by evaluating

Mo dule Pro cessing

the forms in the b o dy in the order they app ear

The following steps summarize the mo dule denition pro

cess

Mo dule Denition

Imp ort Pro cessing Mo dule imp ort clauses either

sp ecify the imp ortation of a mo dule in its entirety or the

selective imp ortation of sp ecied bindings from a mo dule

defmodule syntax

For each imp ort sp ecication the originating mo dule must

exist and in the case of selective sp ecications the named

bindings must b e exp orted from it Each imp ort sp eci

Syntax

cation contributes a set of bindings to the toplexical envi

The syntax of the text of a mo dule is given in Table

ronment of the mo dule b eing dened Each such binding

is checked for nameconict since no two imp orted names

can b e the same Note that mutually referential mo dules

Arguments

are not p ossible b ecause of the denition b efore use re

quirement Hence the imp ortation dep endencies form a

modulename A symb ol used to name the mo dule

DAG

Syntax Expansion The syntax section sp ecies the importspec An expression sp ecifying the mo dules on

mo dules required for syntax expansion and any lo cally which the execution of this mo dule dep ends and how their

dened syntax The b o dy of the mo dule is expanded ac exp orts are to b e named for reference in this mo dule

Programming Language EuLisp version

Table Mo dule syntax

importspec moduledirective

syntaxspec j syntax importspec defmacro

exportspec export j exportsyntax j expose

export export name

exportsyntax exportsyntax name

expose expose moduledirective

moduledirective modulename j modulelter

modulelter except j only j rename

+

except except name moduledirective

+

only only name moduledirective

+

rename rename oldname newname moduledirective

moduleexpression exportspec j levelexpression j denition j progn expression

denition leveldenition

fdefmoduleg

syntaxspec An expression sp ecifying the mo dules on Ob jects

which the expansion of this mo dule dep ends and how their

exp orts are to b e named for reference in this mo dule

In EULISP every ob ject in the system has a sp ecic class

Classes themselves are rstclass ob jects In this resp ect

moduleexpression A sequence of denitions expres

EULISP diers from staticallytyp ed ob jectoriented lan

sions and exp ort sp ecications

guages such as C and CEYX The EULISP ob ject system

is called TELOS

Remarks

Programs written using TELOS typically involve the design

of a class hierarchy where each class represents a category of

The defmodule form denes a mo dule named by module

entities in the problem domain and a protocol which denes

name and stores a mo dule ob ject in the mo dule binding en

the op erations on the ob jects in the problem domain

vironment under the name modulename

A class denes the structure and b ehavior of its instances

Examples

Structure is the information contained in the classs instances

and behavior is the way in which the instances are treated

An example mo dule denition with explanatory comments

by the proto col dened for them

is given in Figure

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 functions which are functions

whose b ehavior dep ends on the classes of their arguments

The particular classsp ecic b ehavior is partitioned into sep

arate units called methods A metho d is not a function itself

but is a closed expression which is a comp onent of a generic

function

It may b e p ossible in an implementation to acquire a p ointer

that do es not corresp ond to any EULISP ob ject It is an error

to pass such a p ointer to a function The default domain for

arguments of functions is object

Creating and Initializing Ob jects

Ob jects can b e created calling

constructors predened or user dened or

make the general constructor function

The general constructor make creates a new ob ject calling

allocate and initiali zes it calling initialize allocate

discriminates on the class while initialize discrimina tes

on the new ob ject Both initialize and allocate as well

as more sp ecic constructors are describ ed in more detail

in section The default allocate metho d creates a new

uninitial ized ob ject that is all slots are unb ound The de

fault initialize metho d see b elow is applicabl e to any

ob ject although there are also more sp ecic metho ds for

classes slot descriptors generic functions and metho ds

Programming Language EuLisp version

Table genericprin output syntax

initialize generic function

prindatum princharacter j number j prinstring j

structure j prinsymbol

Generic Arguments

princharacter anycharacter

prinstring prinstringchar

object object The ob ject to initiali ze

prinsymbol prinstring

prinstringchar anycharacter

initlist list The list of initiali zati on arguments

Result

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

users dene new classes they can sp ecify which readers and

The initialize d ob ject

writers should b e accessible in a mo dule and by which bind

ing Accessor bindings are not exp orted automatically when

Remarks

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

explicitly

Initializes an ob ject using the most sp ecic metho d for the

class of the ob ject and returns the initialize d ob ject as the

At the metalevel there is a proto col which allows user de

result

ned metho ds for the computation of sp ecial accessors for

example those checking the typ e of a value when storing a

new one

initialize method

Sp eciali zed Arguments

External Representation

object object The ob ject to initiali ze

genericprin generic function

initlist list The list of initiali zati on arguments

Generic Arguments

Result

object object An ob ject to b e output on stream

The initialize d ob ject

stream stream The stream on which object is to b e

output

Remarks

This is the default metho d attached to initialize This

metho d p erforms the following steps

Result

a Check if the supplied initargs are legal and signal an

The ob ject supplied as the rst argument

error otherwise Legal initargs are those sp ecied in the

class denition directly or inherited from a sup erclass Ini

targs may b e slotnames or other symb ols

Remarks

b Initialize the slots of the ob ject according to the ini

The individual metho ds for sp ecic classes dene the for

targ if supplied or according to the initfunction stored

mat of the output The representation pro duced by

in the slotdescription followed by calling the anonymous

genericprin may b e more convenient for human reading

writer stored in the slotdescription The initfunction may

but is not guaranteed to by syntactically correct input for a

return unb ound if no initform has b een sp ecied di

EuLisp pro cessor Sp ecically genericprin will not out

rectly in the class denition or none was inherited from a

put escaping information in characters strings or symb ols

sup erclass

This is summarised in the grammar in Table

Legal initargs which do not name a slot are ignored by the

default initialize metho d The default metho d can b e

genericwrite generic function

sp ecialized by calling callnextmethod from more sp ecic

initialize metho ds

Generic Arguments

See also initialize metho ds for classes slot de

object object An ob ject to b e output on stream

scriptors generic functions and metho ds make allocate

stream stream The stream on which object is to b e

Accessing Slots

output

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

writer functions accessors only For system dened ob ject

Result

classes there are predened readers and writers Some of

The ob ject supplied as the rst argument the writers are accessible using the setter function If there

Programming Language EuLisp version

Table genericwrite output syntax

Classes and Slot Desciptions

A class describ es a set of ob jects called its instances in

datum character j number j string j structure j

the problem domain Classes dene the structure of their

symbol

instances through a set of slots which each instance contains

structure list j vector

Classes also dene the b ehavior of their instances through

the metho ds which sp ecialize on them

Remarks

Inheritance is implemented through classes Each class has

The individual metho ds for sp ecic classes dene the for

a class precedence list a linearized list of all the classs su

mat of the output The representation pro duced by

p erclasses which denes the classes from which the class

genericwrite is guaranteed to b e syntactically correct in

inherits structure and b ehavior Slots and metho ds dened

put for a EuLisp pro cessor and will result in an ob ject equal

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

to the original entity The syntax of ob jects output by

may sp ecialize them

genericwrite is given in Table

In EULISP classes are rstclass ob jects and are instances of

some sp ecic class These classes of classes are called meta

classes Extensions such as supp ort

for the changeclass functionality of CLOS and p ersistent

ob jects can b e supp orted through metaclasses In addition

metaclasses can provide new kinds of classes with reduced

p ower but increased eciency the class structureclass

is an example

Classes are dened using the defstruct

defcondition and defclass dening forms New

metaclasses are dened using defmetaclass

Inheritance

The structure and b ehaviour dened for a class is inherited

by all of its sub classes In practice this means that an in

stance of a class will contain all the slots dened directly in

the class as well as all of those dened in the classs sup er

classes In addition a metho d sp ecialized on a particular

class will b e applicabl e for direct and indirect instances of

the class

TELOS level provides only single inheritance meaning that

a class can have exactly one sup erclassbut indenitely

many sub classes In fact all classes in the level class in

heritance tree have exactly one sup erclass except the ro ot

class object which has no sup erclass

Metaclasses control the structure and b ehaviour of their in

stances and the representation of their metainstances It

might not b e p ossible to form a sub class link b etween two

classes of dierent metaclasses The metaob ject proto col

MOP provides means to control compatibil ity b etween

classes with resp ect to the sub class relationhsip

Slot Descriptions

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

an ob ject is dened by its class It is represented by a slot de

scription object which denes where the slot is to b e stored

how it can b e accessed and its default value At level of

EULISP and ab ove the slot description mechanism is sp ecial

izable and extensible New slot description classes to supp ort

extensions such as the facets found in many knowledge rep

resentation languages multivalued slots typ ed slots and

slots whose values are not stored in the instance Slots

are dened within a defstruct defcondition or defclass

dening form New slot description classes are dened by

defclass

Programming Language EuLisp version

System Dened Classes slotdescription A list of slot sp ecications see b e

low comprising either a slotname or a list of a slotname

followed by some slotoptions

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

class hierarchy which is shown in Figure Indentation indi

classoption A sequence of keys and values see b elow

cates a sub class relationship to the class under which the line

has b een indented for example condition is a sub class

of object and the name following the class is the name

Remarks

of the metaclass for example the class of conditionis

conditionclass The names given here corresp ond to

defstruct creates a new structure class The rst argument

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

is the name to which the new class will b e b ound The

the level level or level mo dules

second is identier which names a variable to which the su

p erclass is b ound If superclass is the sup erclass is taken

Figure Level initial class hierarchy

to b e the ro ot structure class structure The list of slot

descriptions is describ ed b elow Finally a classoption is a

object class

identier followed by a corresp onding value which taken

character class

together apply to the class as a whole The syntax of

class class

defstruct is dened in Table

conditionclass class

functionclass class

The slotoptions are interpreted as follows

numberclass class

structureclass class

initarg symbol The value of this option is a identier

naming a symb ol which is the name of an argument to b e

condition conditionclass

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

function functionclass

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 ecied

method class

once for a particular slot The same initarg name may b e

null class

used for several slots in which case they will share the

number numberclass

same initial value if the initarg is given to make

pair class

initform form The value of this option is a form which

semaphore class

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

stream class

string class

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

structure structureclass

The form is evaluated in the lexical environment of the call

symbol class

to defstruct and the dynamic environment of the call to

table class

make The form is evaluated each time make is called and

thread class

the default value is called for The order of evaluation of

vector class

the initforms in all the slots is determined by initialize

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

slot

The ro ot of the instantiatio n hierarchy is the class class

which is an instance of itself The ro ot of the inheritance

reader symbol The value is the identier of the variable

hierarchy is the class object class denes the basic

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

metho ds for access and mo dication of ob jects comp onents

function is a means to access the slot The reader function

In this denition unless otherwise sp ecied all ob jects de

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

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

of the new class No writer function is automatically cre

that class Furthermore unless otherwise sp ecied classes

ated with this option This option can b e sp ecied more

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

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

sub classes

to sp ecify the same reader writer or accessor name for

two dierent slots

Dening Classes

writer symbol The value is the identier of the variable

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

function is a means to change the slot value The creation

defstruct dening form

of the writer is analogous to that of the reader function

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

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

Syntax

name for two dierent slots

defstruct classname superclass slotdescription class

accessor symbol The value is the identier of the vari

option

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

dition the use of this slotoption causes the creation of

Arguments

a writer function which is anonymous but asso ciated to

the reader via the setter mechanism This option can b e

classname A symb ol naming a binding to b e initiali sed sp ecied more than once for a slot It is an error to sp ecify

with the new structure class the same reader writer or accessor name for two dierent

slots

superclass A symb ol naming a binding of a class to b e

used as the sup erclass of the new structure class The class options are interpreted as follows

Programming Language EuLisp version

Table defstruct syntax

classname identier

superclass fan instance of structureclassg

slotdescription slotname j slotname slotoption

slotname identier

slotoption initarg identier j

initform form j

reader readername j

writer writername j

accessor readername

readername identier

writername identier

classoption constructor constructorspec j

predicate predicatename

constructorspec constructorname initoption

constructorname identier

predicatename identier

constructor constructorspec Creates containing the sup erclass If this list is empty the sup erclass

a constructor function for the new class The construc is object The third argument is a list of slotdescriptio ns

tor sp ecication gives the name to which the constructor the format of which is an extension of that for defstruct

function will b e b ound followed by a sequence of legal ini The remaining arguments are class options The syntax of

targs for the class The new function creates an instance defclass is given in Table All the slot options and class

of the class and lls in the slots according to the match options are exactly the same way as for defstruct

b etween the sp ecied initargs and the given arguments to

the constructor function This option may b e sp ecied any

numb er of times for a class Sp ecifying the constructor in

slotdescription class

this way is equivalent to writing a defconstructor form

for the class

The abstract class of all slot descriptions

predicate symbol Creates a predicate function for the

new class The predicate sp ecication gives the name to

which the predicate function will b e b ound This option Creating Ob jects

may b e sp ecied any numb er of times for a class Sp eci

fying the constructor in this way is equivalent to writing

make function

a defpredicate form for the class

Arguments

defclass dening form

class The class of the ob ject to create

Syntax

key obj key obj Initializati on arguments

1 1 n n

defclass classname superclass slotdescription

classoption

Result

An instance of class

Arguments

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

with the new class

The general constructor make creates a new ob ject calling

allocate and initial izes it by calling initialize allocate

superclass A list of a single symb ol naming the bind

discriminates on the class while initialize discrimina tes

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

on the new ob ject

class Multiple sup erclasses can b e sp ecied at level see

section B

teloscondition condition

slotdescription A list of slot sp ecications see b e

low comprising either a slotname or a list of a slotname

followed by some slotoptions

This is the general condition class for conditions arising from

op erations in the ob ject system

classoption A sequence of keys and values see b elow

Remarks

This dening form denes a new class The resulting class

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

Programming Language EuLisp version

Table defclass syntax level

classname identier

superclass fclass or the name of one of its subclassesg

slotdescription slotname j slotname slotoption

slotname identier

levelslotoption initarg identier j

initform form j

reader readername j

writer writername j

accessor readername j

levelclassoption constructor constructorspec

predicate predicatename

Arguments Generic Functions and Metho ds

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

A generic function is a function whose application b ehaviour

function or a converter function

is determined by the classes of its arguments Each p otential

b ehavior is dened by a metho d which sp ecies a signature

genlambdalist The parameter list of the generic func

of classes for which it is applicable A programs proto col

tion which may b e sp ecialised to restrict the domain of

is a set of generic functions and the relationships b etween

metho ds to b e attached to the generic function

them

initoption Options as sp ecied b elow

Generic functions replace the send construct found in many

ob jectoriented languages In contrast to sending a message

to a particular ob ject which it must know how to handle

Remarks

the metho d executed by a generic function is determined by

This dening form denes a new generic function The re all of its arguments Metho ds which sp ecialize on more than

one of their arguments are called multimethods

sulting generic function will b e b ound to gfname The

second argument is the formal parameter list An er

Generic functions are dened using the defgeneric dening

ror is signaled condition noncongruentlambdalists

if any metho d dened on this generic function do es not form which creates a named generic function in the top

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

have a lamb da list congruent to that of the generic

function In addition an error is signaled condition genericlambda which creates an anonymous generic func

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

incompatiblemethodsignature if the metho ds sp ecial

ized lamb da list widens the domain of the generic function

A metho d describ es the applicatio n b ehaviour of a generic

In other words the lamb da lists of all metho ds must sp e

function for a particular sequence of classes called the cialize on sub classes of the classes in the lamb da list of the

metho ds domain Metho ds are not functions themselves

generic function This applies b oth to metho ds dened at

but ob jects attached to a generic function containing closed the same time as the generic function and to any metho ds

expressions

added subsequently by defmethod or addmethod An init

option is a identier followed by a corresp onding value The

Like slots metho ds are inherited from the sup erclasses of

syntax of defgeneric is given in Table

an ob ject That is if a metho d is applicabl e for a class

C it is also applicable for all of C s sub classes as well

The initoption is

1 1

New metho ds may also b e dened for these sub classes and

these metho ds are said to b e more specic than the meth

method methodspec This option is followed by a metho d

o ds dened on the sup er classes However the more general

description A metho d description is a list comprising the

metho ds are accessible from the more sp ecic through the

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

callnextmethod form Thus b ehavior can b e inherited

signature and a sequence of forms denoting the metho d

and extended in sub classes

b o dy The metho d b o dy is closed in the lexical envi

ronment in which the generic function denition app ears

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

This option may b e sp ecied more than once

function or else dened separately using the defmethod

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

Examples

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

In the following example of the use of defgeneric a generic

function named gf is dened with three metho ds attached

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

Dening Generic Functions and Metho ds

classa In consequence each metho d added to the

generic function b oth here and later by defmethod must

have a domain which is a sub class of object classa

defgeneric dening form

which is to say that classc classe and classg

must all b e sub class of classa

Syntax

defgeneric gf arg arg classa

defgeneric gfname genlambdalist levelinitoption method marg classb marg classc

Programming Language EuLisp version

Table defgeneric syntax level

gfname identier j setter identier j converter identier

genlambdalist speclambdalist

levelinitoption method methoddescription

methoddescription speclambdalist form

speclambdalist specvariable variable

specvariable variable class j variable

class classname

method marg classd marg classe Remarks

method marg classf marg classg

Signalled by addmethod if the signature of the metho d

would widen the domain that is is less sp ecic than the

generic function

See also addmethod

noncongruentlambdalists teloscondition

defmethod macro

Initoptions

Syntax

generic function The generic function to b e extended

defmethod gfname speclambdalist form

or

method method The metho d to b e added

defmethod setter identier speclambdalist form

or

defmethod converter identier speclambdalist form

Remarks

Signalled by addmethod if the lamb da list of the metho d is

not congruent to that of the generic function

Remarks

This macro is used for dening new metho ds on generic func

tions A new metho d ob ject is dened with the sp ecied

Sp ecializing Metho ds

b o dy and with the signature given by the sp ecialized lamb da

list This metho d is added to the generic function b ound to

The following op erators

gfname or convertor function asso ciated with class In the

callnextmethod and nextmethodp are used to sp e

former case if the sp ecializedl amb da li st is not congruent

cialize more general metho ds by calling them and p erhaps

with that of the generic function an error is signaled condi

p erforming some additional computations b efore andor af

tion noncongruentlambdalists In addition an error

ter calling the next metho d It is an error to use either of

is signaled condition incompatiblemethodsignature if

these op erators outside a metho d b o dy Argument bindings

the metho ds sp ecialized lamb da list would widen the domain

inside metho ds are immutable Therefore an argument in

of the generic function

side a metho d retains its sp ecialize d class throughout the

pro cessing of the metho d

noapplicablemethod teloscondition

callnextmethod special form

Initoptions

Syntax

generic function The generic function which was ap

callnextmethod

plied

domain list The domain of the sought metho d

Result

The result of calling the next most sp ecic applicabl e

metho d

Remarks

Signalled by the discriminati ng function of a generic function

when there is no metho d which satises the given signature

Remarks

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

same arguments as the current metho d An error is signaled

incompatiblemethodsignature teloscondition

condition nonextmethod if there is no next most sp ecic

metho d

Initoptions

nonextmethod teloscondition

generic function The generic function to b e extended

Initoptions method method The metho d to b e added

Programming Language EuLisp version

method method The metho d which called Threads and Semaphores

callnextmethod

The basic elements of parallel pro cessing in EULISP are pro

operandlist list A list of the arguments to have b een

cesses and mutal exclusion which are provided by the classes

passed to the next metho d

thread and semaphore resp ectively

A thread is an abstract data typ e protecting some

Remarks

implementationde ned data A thread is allo cated and ini

Signalled by callnextmethod if there is no next most sp e tialised like all other ob ject by using make This function

cic metho d is called the initial function and is where execution starts

the rst time the thread is dispatched by the scheduler The

discussion identies four states of a thread new running

ab orted and nished These are for conceptual purp oses only

nextmethodp special form

and are not distinguish abl e in practice The transitions b e

tween these states are summarised in gure The initial

Syntax

state of a thread is new The union of the two nal states is

known as determined

nextmethodp

A thread is made available for dispatch by starting it us

Result

ing the function threadstart which changes its state to

running From running a thread b ecomes either nished or

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

ab orted When a thread has nished the result of the initial

turns a non value otherwise it returns

function may b e accessed using threadvalue If a thread

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

dled by the default handler then threadvalue will signal

the condition on the thread accessing the value Note that

threadvalue blo cks until the sp ecied thread has b een de

termined

Access to shared resources or an undetermined thread while

a thread is running may cause it to b ecome blo cked Thus

a thread may b e blo cked on a semaphore inputoutput or

threadvalue In each of these cases threadresechedule

is called to allow another thread to execute This function

may also b e called voluntarily A thread may b e unblo cked

by some other thread executing closesemaphore on the

semaphore on which the rst thread is blo cked Thus the

call to threadreschedule returns

The actions of a thread can b e inuenced externally by

signal This function registers a condition to b e sig

nalled when the sp ecied thread is rescheduled for execu

tion The condition must b e an instance of a sub class of

threadcondition Conditions are delivered to the thread

in order of receipt A signal on a determined thread has no

eect on either the signalled or signalli ng thread See also

section

A semaphore is an abstract data typ e protecting a binary

value call these values zero and one The op erations on a

sempahore are closesemaphore and opensemaphore The

opensemaphore op erations sets the value to zero if it is one

or changes the state of the thread executing the op eration

to blocked if the value is zero and reschedules the thread

The closesemaphore op eration sets the value to one and if

there are any threads blo cked on this semaphore one will b e

selected and unblo cked

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

a A pro cessor is free to use runtocompletion timeslic

ing andor concurrent execution

b A conforming program must assume the p ossibility of

concurrent execution of threads and will have the same

Programming Language EuLisp version

Figure State diagram for threads

change the data If it is not using a semaphore the fairness

guarantee ensures that in the same scenario the following

lo op will exit eventually

make

while data threadreschedule

V

NEW

Threads

threadstart

V

The dened name of this mo dule is thread This section

RUNNING

denes the op erations on threads

default initial

signal function

thread class

handler returns

V V

ABORTED FINISHED

The class of all instances of thread

Initoptions

semantics in all casessee discussion of fairness which fol

lows

initfn initialfunction an instance of function which

will b e called when the resulting thread is started

c The default condition handler for a new thread when

invoked will change the state of the thread to aborted

size integer a p ositive integer sp ecifying in

save the signalled condition and reschedule the thread

implementation den ed units the size of the thread to b e

allo cated

d An error is signaled condition wrongthread if a

continuation is called from a thread other than the one on

which it was created That is to say a continuation must

threadp function

only b e called from within its dynamic extent

e The lexical environment inner and top asso ciated

Arguments

with the initial function is shared by the thread as is the

topdynamic environment but each thread has a distinct

obj ob ject to examine

innerdynamic environment

Result

f The creation and starting of a thread represent

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

The supplied argument if it is an instance of thread other

aected by the pro cessors handling of errors signaled sub

wise

sequently on the creatingstarting thread cf streams

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

side the creation of the subsidiary thread has no default

threadreschedule function

eect on the subsidiary thread

g The b ehaviour of io on the same stream by multiple

This function takes no arguments

threads is undened

Result

The parallel semantics are preserved on a sequential run

tocompletion implementation by requiring communication

The result is

b etween threads to use only thread primitives and shared

data protected by semaphoresb oth the thread primitives

Remarks

and semaphores will cause rescheduling so other threads can

b e assumed to have a chance of execution

This function is called for sideeect only and causes the

thread which executes it to b ecome blo cked If conditions are

There is no guarantee ab out which thread is selected next

p ending on the thread when threadreschedule continues

However a fairness guarantee is needed to provide the il

one is selected arbitrarily and signalled No further p ending

lusion that every other thread is running A strong guar

conditions will b e signalled until the handler pro cessing the

antee would ensure that every other thread gets scheduled

condition has exited Up on exit from the handler the thread

b efore a thread which reschedules itself is scheduled again

is rescheduled again

Such a scheme is usually called roundrobin This could

b e stronger than the guarantee provided by a parallel imple

See also threadvalue threadsignal

mentation or the scheduler of the host op erating system

A weak but sucient guarantee is that if any thread resched

ules innitely often then every other thread will b e scheduled

currentthread function

innitely often Hence if a thread is waiting for shared data

to b e changed by another thread and is using a semaphore

the other thread is guaranteed to have the opp ortunity to This function takes no arguments

Programming Language EuLisp version

Result

wait method

The thread on which currentthread was executed

Sp ecialized Arguments

threadstart function

thread thread The thread on which to wait

Arguments

timeout object The timeout p erio d

thread the thread to b e started which must b e in state

Result

new If not an error is signaled condition oldthread

Returns thread if thread is determined

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

1 n

initial function of thread

See also wait

Result

threadcondition condition

The thread which was was supplied as the rst argument

Initoptions

Remarks

currentthread thread Thread which is signalling the

The state of thread is changed to running The values ob j

condition 1

to ob j will b e passed as arguments to the initial function of

n

thread

Remarks

This is the general condition class for all conditions arising

from thread op erations

threadvalue function

Arguments

wrongthread threadcondition

thread the thread whose nished value is to b e accessed

Initoptions

continuation continuation A continuation

Result

The result of the initial function applied to the arguments

thread thread Thread on which continuation was cre

passed from threadstart However if a condition is sig

ated

nalled on thread which is handled by the default handler

the condition will now b e signalled on the thread executing

Remarks

threadvalue

Signalled if the given continuation is called on a thread other

than the one on which it was created

Remarks

If thread is not determined the thread executing

oldthread threadcondition

threadvalue is blo cked until thread is determined

Initoptions

See also threadreschedule threadsignal

thread thread A thread

Result

Remarks

The result is

Signalled by threadstart if the given thread has b een

started already

Remarks

Registers the sp ecied condition or by default an instance

genericprin method

of threadcondition to b e signalled when thread is resched

uled for execution A threadsignal on a determined thread

has no eect on either the signalled or signalli ng thread

genericwrite method

Sp ecialized Arguments See also threadreschedule threadvalue

Programming Language EuLisp version

thread thread The thread to b e ouptut on stream

closesemaphore function

stream stream The stream on which the represen

tation is to b e output

Arguments

semaphore the semaphore to b e closed

Result

The thread supplied as the rst argument

Result

The semaphore supplied as argument

Remarks

Outputs the external representation of thread on stream

Remarks

The external representation of thread is pro cessordened

Set the value of semaphore to one and if there are any threads

blo cked on this semaphore select one and unblo ck it This

op eration is atomic That thread may then attempt to op en

Semaphores

the semaphore again

The dened name of this mo dule is semaphore

See also opensemaphore

semaphore class

genericprin method

The class of all instances of semaphore This class has no

Arguments

initoptions The result of calling make on semaphore is a

new op en semaphore

semaphore the semaphore to b e ouptut on stream

stream the stream on which the representation is to b e

output

semaphorep function

Result

Arguments

The thread supplied as the rst argument

obj ob ject to examine

Remarks

Outputs the external representation of semaphore on stream

Result

The external representation of semaphore is pro cessor

The supplied argument if it is an instance of semaphore

dened

otherwise

genericwrite method

opensemaphore function

Arguments

Arguments

semaphore the semaphore to b e ouptut on stream

semaphore the semaphore to b e op ened

stream the stream on which the representation is to b e

output

Result

Result

The semaphore supplied as argument

The thread supplied as the rst argument

Remarks

Remarks

Set the value of semaphore to zero if it is one or blo ck the

Outputs the external representation of semaphore on stream

thread executing opensemaphore if the value is to zero and

The external representation of semaphore is pro cessor

call threadreschedule This op eration is atomic On b e

dened

ing unblo cked the call to opensemaphore will continue by

attempting to op en the semaphore

See also closesemaphore

Programming Language EuLisp version

Figure Level initial condition class hierarchy

Conditions

condition conditionclass

The dened name of this mo dule is condition

executioncondition condition

invalidoperator condition

The condition system owes much to the Common Lisp er

badapplyargument condition

ror system Pitman and to the Standard ML excep

cannotupdatesetter condition

tion mechanism It is a simplicati on of the former and an

nosetter condition

extension of the latter Following standard practice this

improperunquotesplice condition

do cument has dened the b ehaviour of functions in terms

environmentcondition condition

of their normal b ehaviour Where an exceptional b ehaviour

arithmeticcondition condition

might arise this has b een dened in terms of a condition

divisionbyzero condition

However not all exceptional situations are errors Following

conversioncondition condition

Pitman we use condition to b e a kind of o ccasion in a pro

noconverter condition

gram when an exceptional situation has b een signaled An

streamcondition condition

error is a kind of conditione rror and condition are also used

syntaxerror condition

as terms for the ob jects that describ e exceptional situations

threadcondition condition

A condition can b e signaled continuably or noncontinuabl y

teloscondition condition

nonextmethod condition

These two classes are characterised as follows

noncongruentlambdalists condition

incompatiblemethodsignature condition

a A condition might b e signaled when some limit has

noapplicablemethod condition

b een transgressed and some corrective action is needed

b efore pro cessing can resume For example memory zone

exhaustion on attempting to heapallo cate an item can b e

corrected by calling the memory management scheme to

executioncondition condition

recover dead space However if no space was recovered a

new kind of condition has arisen Another example arises

in the use of IEEE oating p oint arithmetic where a con

This is the general condition class for conditions arising from

dition might b e signaled to indicate divergence of an op

the execution of programs by the pro cessor

eration A continuable condition should b e signaled when

there is a strategy for recovery from the condition

environmentcondition condition

b Alternatively a condition might b e signaled when

some catastrophic situation is recognised such as the

This is the general condition class for conditions arising from

memory manager b eing unable to allo cate more memory

the environment of the pro cessor

or unable to recover sucent memory from that already

allo cated a noncontinuable condition should b e signaled

when there is no reasonable way to resume pro cessing

Condition Handling

A condition class is dened with defcondition or defclass

Conditions are handled with a function called a hand ler

The denition of a condition causes the creation of a new

Handlers are established dynamicall y and have dynamic

class of condition including a new condition class construc

scop e and extent Thus when a condition is signaled the

tor A condition is signaled using the function signal which

pro cessor will call the dynamically closest handler Note that

takes an instance of a condition and a resume continuation

it is the rst handler accepting to pro cess the condition that

or the empty list signifying a noncontinuabl e condition as

is used and not necessarily the most sp ecic Handlers are

arguments A condition can b e handled using the sp ecial

established by the sp ecial form withhandler

form withhandler which takes a functionthe handler

functionand a sequence of forms to b e protected The

initial condition class hierarchy is shown in Figure

signal function

Called to indicate that sp ecied condition has arisen during

the exection of a program

condition class

Arguments

Initoptions

condition The condition to b e signaled

message string A string continaing information which

should p ertain to the situation which caused the condition

function The function or continuation to b e called if

to b e signalled

the condition is handled and resumed that is to say the

condition is continuable

thread If this argument is not supplied the condition

is signalled on the thread which called signal otherwise

Remarks

thread indicates the thread on which condition is to b e

signalled

The class which is the sup erclass of all condition classes

Programming Language EuLisp version

Result Remarks

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

establishment of the new hand lerfunction

If the third argument is not supplied signal calls the dy

namically closest handler with conditionthe condition b e

c The sequence of protectedforms is evaluated in order

ing signaledan d either continuation or If the second

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

argument is a sub class of function that is the resume con

the withhandler expression

tinuation to b e used in the case of a handler deciding to re

sume from a continuable condition If the second argument

d the hand lerfunction is disestablis hed and the previ

is it indicates that the condition was signaled as a non

ous handler is no longer shadowed

continuable conditioni n this way the handler is informed

of the signalers intention

The ab ove is the normal b ehaviour of withhandler The

exceptional b ehaviour of withhandler happ ens when there

If the third argument is supplied signal registers the

is a call to signal during the evaluation of protectedform

sp ecied condition to b e signalled when thread is resched

signal calls the dynamicall y closest hand lerfunction pass

uled for execution The condition must b e an instance of

ing on the two arguments given to signal The hand ler

threadcondition otherwise an error is signalled condi

function is executed in the dynamic extent of the call to

tion wrongconditionclass on the thread calling signal

signal However any signals o ccurring during the exe

A signal on a determined thread has no eect on either the

cution of hand lerfunction are dealt with by the dynami

signalled or signallin g thread

cally closest handler outside the extent of the form which

established hand lerfunction A hand lerfunction takes one

of three actions

See also threadreschedule threadvalue

withhandler

a Return This causes the nextclosest enclosing

hand lerfunction to b e called passing on the condition

and the resume continuation This is termed declining

the condition The situation when there is no next closest

wrongconditionclass threadcondition

enclosing handler is discussed later

b Call the resume continuation This action might b e

Initoptions

taken if the condition is recognised by the handler function

and might b e preceded by some corrective action This is

condition condition A condition

termed resuming the condition

Signalled by signal if the given condition is not an instance

c Not return and not call the resume continuation This

of threadcondition

action might b e taken if the condition is recognised by the

handler function and might b e preceded by some corrective

action b efore some kind of transfer of control This is

termed accepting the condition

withhandler special form

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

closest enclosing handler In this circumstance the identied

Syntax

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

withhandler handlerfunction protectedform

implementationde ned way

Examples

Arguments

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

hand lerfunction A function or a generic function which

following unrealistic example

will b e called if a condition is signaled during the

synamic extent of protectedforms A handler function

letcc accept

takes two argumentsa condition and a resume func

withhandler

genericlambda condition resume

tioncontinuati on The condition is the condition ob ject

method error xable return to cerror resume

that was passed to signal as its rst argument The re

c continuablecondition

sume continuation is the continuation or that was

resume fix condition

given to signal as its second argument

method serious error exit from withhand ler accept

c condition

protectedform The sequence of forms whose execution

accept

is protected by the hand lerfunction sp ecied ab ove

otherwise by omission let another hand ler deal

with it decline

the protected expression

Result

somethingwhichmightsignalanerror

The value of the last form in the sequence of protectedforms

Programming Language EuLisp version

See also signal initoption a sequence of options to b e passed to

initializeinstance when making the instance of con

dition

Conditions

Result

conditionp function

The result of b oth of these functions is

Arguments

Remarks

obj ob ject to examine

The cerror and error functions signal continuable and non

continuable errors resp ectively Each calls signal with an

instance of a condition of conditionclass initiali zed from init

Result

option s the errormessage and a resume continuation In the

Returns obj if obj is a sub class of condition otherwise

case of cerror the resume continuation is the continuation

of the cerror expression In the case of error it is

signifying that the condition was not signaled continuably

conditionmessage function

cerror and error can b e dened in terms of more primitive

op erations

Arguments

cerror errormessage condition initarg

condition an instance of condition

letcc cerrorfixedup

let c make condition initarg

signal c cerrorfixedup

Result

return comes here

nohand ler c cerrorfixedup

Returns the contents of the message slot of condition which

resume comes here

is a string

error errormessage condition initarg

initializeinstance method

let c make condition initarg

signal c

return comes here

Arguments

nohand ler c

condition an instance of condition

The function nohand ler is that which changes the state of

the thread to aborted and saves the signaled condition for

initoption a sequence of options

future reference This function is called after all handlers

have declined the condition That is nohand ler is only

called when none of the handlers can deal with the condition

Result

Note that b oth the condition and the resume continuation

A new initiali sed condition

are given to nohand ler as for any other handler function

so that for instance execution could b e resumed from the

debugger Also note that nohand ler is called in the envi

Remarks

ronment of the signal so that all the handlers in force at

the time of signaling are also in force during the call to no

First calls callnextmethod to carry out initializ atio n sp ec

hand ler

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

tialization The following initoption is recognised by this

metho d

defcondition dening form

message The value must b e a string which should b e

used to convey information ab out the condition that has

arisen

Syntax

defcondition conditionna me sup erclass initoption

error function

Arguments

conditionname A symb ol naming a binding to b e ini

cerror function

tialised with the new condition class

superclass A symb ol naming a binding of a class to b e

Arguments

used as the sup erclass of the new condition class

errormessage a string containing relevant information

initoption A sequence of symb ols and expressions to

b e passed to al locateinstance and initializeinstance

conditionclass the class of condition to b e signalled

Programming Language EuLisp version

Remarks Expressions Denitions and Control

Forms

This dening form denes a new condition class The rst

argument is the name to which the new condition class will

This section gives the informal syntax of wellformed expres

b e b ound The second is the sup erclass of the new condition

sions and describ es the semantics of the sp ecialforms func

and an initoption is a identier followed by its default

tions and macros of the level language In the case of level

initial value If superclass is the sup erclass is taken to b e

macros the description is augmented with an expansion

condition Otherwise superclass must b e condition or one

which has the required semantics However these descrip

of its sub classes

tions are not prescriptive of any pro cessor and a conforming

program cannot rely on adherence to these expansions

Atomic Expressions

constant syntax

There are two kinds of constant literal constants and dened

constants The latter are considered under symbols A literal

constant is a numb 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 The external representation

of the empty list is The empty list is the only instance

of the class null For historical reasons the symb ol nil is

dened to b e immutably b ound to the empty list

Examples

the empty list

a single precision integer

a a character

abc a string

defconstant dening form

Syntax

defconstant identier form

Arguments

identier A symb ol naming an immutable toplexical

binding containing the value of form

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

of identier

Remarks

The value of form is stored as the mo dule value of name It

is an error to set the value of a dened constant to a dierent

value

symbol syntax

The current lexical binding of symbol is returned A symb ol

can also name a dened constantthat is an immutable

toplexical binding The dened constant t has the value t

The dened constant nil has the value which represents

the abstract b o olean value false The abstract b o olean value

true can represented by any value other than falsethat is

other than

Programming Language EuLisp version

Result

deflocal dening form

A function with the sp ecied lambdalist and body

Syntax

Remarks

deflocal identier form

The function construction op erator is lambda Access to the

lexical environment of denition is guaranteed which may

cause the creation of a closure The syntax of lambdalist is

Arguments

dened by the following grammar

identier A symb ol naming a binding containing the

lambdalist identier j simplelist j restlist

value of form

simplelist identier

+

restlist identier identier

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

of identier

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

Remarks

the arguments are b ound to the corresp onding identiers

The value of form is stored as the mo dule binding value of

Otherwise lambdalist must b e a restlist In this case each

name The binding created by a deflocal form is mutable

identier preceding the dot is b ound to the corresp onding

argument and the identier succeeding the dot is b ound to

a newly allo cated list whose elements are the remaining ar

Literal Expressions

guments These bindings have lexical scop e and extent It

is an error if the same identier app ears more than once in

a lambdalist quote special form

Syntax

function call special form

quote datum

Syntax

Arguments

operator operand

datum the datum to b e quoted

Arguments

Result

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

The result is datum

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

which must result in an instance of function An error is

signaled condition invalidoperator if the op erator is

Remarks

neither the name of a sp ecial form nor a function

The result of pro cessing the expression quote datum is da

tum The ob ject datum can b e any external representation of

operand Each operand must b e either an atomic expres

a EULISP ob ject The sp ecial form quote can b e abbreviated

sion a literal expression or a function call

using apostrophegraphic representation in the standard

tokenisation schemeso that quote a can b e written a

Result

These two notations are used to incorp orate literal constants

in programs It is an error to mo dify the contents of a literal

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

expression Within a single mo dule multiple references to

evaluation of operand

the same eq literal pro duce the same literal

Remarks

Functions Application Denition

The operand expressions are evaluated in order from left to

right The operator expression may b e evaluated at any time

lambda special form

b efore during or after the evaluation of the op erands

Syntax

See also constant symbol quote

lambda lambdalist body

invalidoperator executioncondition

Arguments

lambdalist The parameter list of the function conform

Initoptions

ing to the syntax sp ecied b elow

invalidoperator object The ob ject which was b eing

body A sequence of forms

used as an op erator

Programming Language EuLisp version

operandlist list The op erands prepared for the op er

ator

apply function

Remarks

Syntax

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

apply function obj obj

1 n

of function

Arguments

defmacro dening form

function An expression which must evaluate to an in

stance of function

Syntax

defmacro macroname lambdalist body

obj obj A sequence of expressions which wil b e

1 n1

evaluated according to the rules given in function call

Arguments

obj An expression which must evaluate to a prop er list

n

An error is signaled condition badapplyargument if

macroname A symb ol naming a binding containing the

obj is not a prop er list

n

function with the sp ecied lambdalist and body

lambdalist The parameter list of the function conform

Result

ing to the syntax sp ecied under lambda

The result is the result of calling function with the actual

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

n

body A sequence of forms

arguments obj through obj An error is signalled con

1 n1

dition invalidoperator if the rst argument is not an

instance of function

Remarks

The defmacro form denes a function named by macroname

and stores the denition as the mo dule binding value of

See also function call

macroname In addition the function macroname is ex

p orted with the syntax attribute set The interpretation of

the lambdalist is as dened for lambda see section

badapplyargument executioncondition

The binding created by defmacro is immutable

Initoptions

See also lambda

arglist list A list of the ob jects passed to apply

defun dening form

Remarks

Signalled by apply if its rst argument is not an instance of

Syntax

function

defun functionname lamb dalist b o dy

or

defun setter functionname lamb dalist b o dy

Assignments

An assignment op eration mo dies the contents of a binding

Arguments

named by a identierthat is a variable

The rst argument can take two forms

setq special form

functionname A symb ol naming a binding contain

ing the function with the sp ecied lambdalist and body

Syntax

setter functionname An expression denoting

the setter function to corresp ond to functionname

setq identier expression

lambdalist The parameter list of the function conform

Arguments

ing to the syntax sp ecied under lambda

identier The identier whose lexical binding is to b e

body A sequence of forms

up dated

Remarks

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

The defun form denes a function named by functionname

binding of identier

and stores the denition as the mo dule value of function

name The interpretation of the lambdalist is as dened for

Result

lambda see section The binding created by defun is

The result is the value of form immutable

Programming Language EuLisp version

Remarks Conditional Expressions

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

closest lexical binding named by identier It is an error to

if special form

mo dify an immutable binding

Syntax

setter function

if expression expression expression

Arguments

Arguments

accessfunction An expression which must evaluate to antecedent An expression which may evaluate to any ob

an instance of function ject

consequence An expression which may evaluate to any

Result

ob ject

The updatefunction corresp onding to accessfunction

alternative An expression which may evaluate to any ob

ject

Remarks

A generalized place up date facility is provided by setter

Result

Given accessfunction setter returns the corresp onding up

Either the value of consequence or alternative dep ending on

date function If no such function is known to setter an er

the value of antecedent

ror is signaled condition nosetter Thus setter car

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

Remarks

tion which is accessed by the expression setter setter

The antecedent is evaluated If the result is true the conse

Thus setter setter anaccessor anupdator installs

quence is evaluated otherwise the alternative is evaluated

the function which is the value of anupdator as the up dator

Both consequence and alternative must b e sp ecied The

of the accessor function which is the value of anaccessor

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

Dened up dator functions in this rep ort have the same im

consequence or alternative is chosen consequence is a single

mutable status as other standard functions such that at

form but alternative is a sequence of forms Each form in al

tempting to redene such a function for example setter

ternative is evaluated in order and the result of the last form

setter car anewvalue signals an error condition

is the result of the if expression Additional conditional

cannotupdatesetter

forms when unless are given in section B

See also defun defmethod

cond macro

nosetter executioncondition

Syntax

cond antecedent form

Initoptions

object object The ob ject given to setter

Remarks

The cond macro provides a convenient syntax for collections

of ifthenelifelse expressions The rewrite rules for cond

Remarks

are

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

tion

cond 

cond antecedent  or antecedent

cond t form  progn form

cannotupdatesetter executioncondition

 or antecedent cond

1

cond antecedent

1

antecedent form antecedent form

2 2

Initoptions

 if antecedent cond

1

progn form antecedent form

accessor object The given accessor ob ject

1

1

cond antecedent form

2

antecedent form

2

updator object The given up dator ob ject

2

Remarks

and macro

Signalled by setter setter if the up dator of the given

accessor is immutable

Syntax

and form See also setter

Programming Language EuLisp version

Remarks See also block returnfrom

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

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

the sequence that evaluates to stops evaluation and none labels special form

of the forms to its right will b e evaluated The result of and

is If none of the forms evaluate to the value of the

Syntax

last form is returned The rewrite rules for and are

labels functionname lambdalist body labelsbody

and  t

Remarks

and form  form

and form form  if form and form

The labels op erator provides for lo cal mutually recursive

1 2 1 2

function creation Each functionname is b ound to a new

lo cation holding an unsp ecied value making a new envi

ronment extended by those bindings Then for each set of

or macro

formal parameters and body a function is constructed using

lambda and the binding of the corresp onding functionname

Syntax

is up dated to have the value of the lamb da expression The

scop e of the functionnames is the entire labels form The

or form

lambdalist is either a single variable or a list of variables

see lambda Each form in labelsbody is evaluated in order in

the ab ove extended environment The result of evaluating

Remarks

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

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

sequence of forms from left to right The value of the rst

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

let macro

none of the forms to its right will b e evaluated If none of the

forms evaluate to true the value of the last form is returned

The rewrite rules for or are

Syntax

let identier binding body

or 

or form  form

or form form  let x form

1 2 1

Remarks

if x x or form

2

The optional identier denotes that the let form can b e called

from within its body This is an abbreviation for labels com

where x do es not o ccur free in any of form form

2 n

bined with let A binding is sp ecied by either an identier

or a two element list of an identier and an initiali zin g form

All the initiali zi ng forms are evaluated in order from left to

Variable Binding and Sequences

right in the current environment and the variables named

by the identiers in the bindings are b ound to new lo cations

letcc special form

holding the results Each form in body is evaluated in order

in the environment extended by the ab ove bindings The

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

Syntax

result of the let form The rewrite rule for let is

letcc identier body

let form  progn form

let id form  lambda id id id

1 1 1 2 3

Arguments

id form form

2 2

id form form

3 1 2

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

form

form

body A sequence of forms

let macro

Result

Syntax

The result of evaluating the last form in body

let identier binding body

Remarks

Remarks

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

The optional identier denotes that the let form can b e called ized with the continuation of the letcc form This binding

from within its body This is an abbreviation for labels com is immutable and has lexical scop e and indenite extent

bined with let A binding is sp ecied by a two element list Each form in body is evaluated in order in the environment

of a variable and an initiali zi ng form The rst initializ in g extended by the ab ove binding It is an error to call the con

form is evaluated in the current environment and the corre tinuation outside the dynamic extent of the letcc form that

sp onding variable is b ound to a new lo cation containing that created it The continuation is a function of one argument

Programming Language EuLisp version

result Subsequent bindings are pro cessed in turn evaluat o ccur during the pro cessing of the afterforms the after

ing the initiali zin g form in the environment extended by the forms b eing pro cessed are not reentered Instead control is

previous binding Each form in body is evaluated in order in transferred to wherever sp ecied by the new nonlo cal exit

the environment extended by the ab ove bindings The result but the afterforms of any intervening unwindprotects b e

of evaluating the last form is returned as the result of the tween the dynamic extent of the target of control transfer

let form The rewrite rules for let are and the current unwindprotect are evaluated in increasing

order of dynamic extent

let form progn form

let var form let var form

1 1 1 1

var form let var form Waiting on Events

2 2 2 2

var var

3 3

wait generic function

form form

Arguments

progn special form

obj An ob ject

timeout One of t or an instance of integer

Syntax

progn form

Result

Returns if timeout was reached otherwise a non value

Arguments

form A sequence of forms and in certain circumstances

Remarks

dening forms

wait provides a generic interface to blo cking op erations Ex

ecution of the current thread will continue b eyond the wait

form only when one of the following happ ened

Result

The sequence of forms is evaluated in order returning the

a A predicate asso ciated with obj returns true

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

b After timeout time units

Remarks

c A signal is received

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

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

wait returns if timeout o ccurs else it returns a nonnil

dening forms It is a static error if this rule is violated

value

A timeout argument of or zero denotes a p olling op era

tion A timeout argument of t denotes indenite blo cking

unwindprotect special form

A timeout argument of a nonnegative integer denotes the

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

of time units in a second is given by the implementation

Syntax

dened constant tickspersecond

unwindprotect protectedform afterform

Examples

Arguments

This co de fragment copies characters from stream s to the

current output stream until no data is received on the stream

protectedform A form

for a p erio d of at least second

afterform A sequence of forms

labels

loop

when wait s cuckooheartbeat

Result

print readchar s

The value of protectedform

loop

loop

Remarks

See also threads streams

The normal action of unwindprotect is to pro cess protected

form and then each of afterforms in order returning the

value of protectedform as the result of unwindprotect A

nonlo cal exit from the dynamic extent of protectedform

tickspersecond doubleoat

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

will cause each of afterforms to b e pro cessed b efore con

The numb er of time units in a second expressed as a trol go es to the continuation sp ecied in the nonlo cal exit

double precision oating p oint numb er This value is form The afterforms are not protected in any way by the

implementationde ned current unwindprotect Should any kind of nonlo cal exit

Programming Language EuLisp version

Table Quasiquote Syntax

antiquotation

unquotation

unquotesplice

quasiquotation quasiquotation

1

template expression

0

quasiquotation template j quasiquote template

i i i

template oneofsimpledatum listtemplate vectortemplate unquotation

i i i i

+

listtemplate templateorsplice j templateorsplice template j

i i

i

i

template j quasiquotation

i i+1

vectortemplate templateorsplice

i

i

unquotation template j unquote template

i i1 i1

templateorsplice template j splicingunquotation

i i i

splicingunquotation template j unquotesplicing template

i i1 i1

Quasiquotation Expressions attempting to unquotesplice an improp er list The in

sertion of the result of an unquotespli ce expression is as if

the op ening and closing parentheses of the list are removed

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

quasiquote macro

unquotesplice expression

The syntax forms unquote and unquotesplicing can b e

Syntax

abbreviated resp ectively by using the glyph called comma

quasiquote skeleton or skeleton

preceding an expression and by using the diphthong

comma followed by the glyph called commercial at pre

ceding a form Thus unquote a may b e written a and

Remarks

unquotesplicing a can b e written a

Quasiquotation is also known as backquoting A

quasiquoted expression is a convenient way of buildin g a

structure The skeleton describ es the shap e and generally

improperunquotesplice executioncondition

many of the entries in the structure but some holes remain

to b e lled The quasiquote macro might b e abbreviated by

using the glyph called grave accent so that quasiquote

Initoptions

expression can b e written expression A complete de

nition of the syntax of quasiquote expressions is given in

skeleton skeleton The skeleton that unquote is pro cess

Table

ing

splicelist list The improp er list which has lead to

unquote syntax

the error

Syntax

Remarks

Signalled by quasiquote unquote form or form

if the result of an unquotesplicing form is not a prop er

list

Remarks

See unquotesplicing

Summary of Level Expressions and Def

initions

unquotesplicing syntax

The syntax of all level expressions and denitions is given

in Table Any pro ductions undened here app ear else

where in the denition sp ecically the syntax of certain

Syntax

classes of data are dened in their own sections

unquotesplicing form or form

Remarks

The holes in a quasiquoted expression are identied by un

quote expressions of which there are two kindsforms whose

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

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

lo cation The former is indicated by an unquote expres

sion and the latter by an unquotesplicing expression In

unquotesplice the form must result in a prop er list An

error is signaled condition improperunquotesplice on

Programming Language EuLisp version

Table Expressions and Denitions level

leveldenition defconstant j defcondition j deocal j defmacro j defmodule j defstruct j defun

defcondition defcondition conditionname superclass initoption

defconstant defconstant identier form

deocal deflocal identier form

defmacro defmacro macroname lambdalist body

defmodule defmodule modulename importspec syntaxspec moduleexpression

importspec moduledirective

syntaxspec j syntax importspec defmacro

exportspec export j exportsyntax j expose

export export name

exportsyntax exportsyntax name

expose expose moduledirective

moduledirective modulename j modulelter

modulelter except j only j rename

+

except except name moduledirective

+

only only name moduledirective

+

rename rename oldname newname moduledirective

moduleexpression exportspec j levelexpression j denition j progn expression

denition leveldenition

fdefmoduleg

defgeneric defgeneric gfname genlambdalist levelinitoption

gfname identier j setter identier j converter identier

genlambdalist speclambdalist

levelinitoption method methoddescription

methoddescription speclambdalist form

speclambdalist specvariable variable

specvariable variable class j variable

class classname

defstruct defstruct classname superclass slotdescription classoption

defun defun functionname lambdalist body j

defun setter functionname lambdalist body

levelexpression lexref j literal j procedurecal l j macrocal l j levelspecial j quasiquotation

levelspecial conditional j lambda j letcc j progn j lexassign j unwindprotect j

withhand ler

lexref identier

literal quotation j selfevaluating

quotation quote datum

lexassign setq identier expression

conditional if expression expression expression

lambda lambda lambdalist body

lambdalist identier j simplelist j restlist

simplelist identier

+

restlist identier identier

letcc letcc identier body

progn progn form

withhand ler withhandler hand lerfunction protectedform

unwindprotect unwindprotect protectedform afterform

selfevaluating character j number j string j vector

procedurecal l procedureoperator operand

macrocal l macrooperator operand

procedureoperator expression

operand expression

macrooperator symbol

variable identier

body expression

Programming Language EuLisp version

Annex A

normative

Level Mo dule Library

A Characters A Result

Returns obj if obj is an instance of a sub class character

The dened name of this mo dule is character

otherwise

A character syntax

A converter integer method

Character literals are denoted by the extension glyph called

A Arguments

hash followed by the characterextension glyph called

reverse solidus followed by the name of the character

character A character

For most characters their name is the same as the glyph as

so ciated with the character for example the character a

has the name a and has the external representation a

A Result

Certain characters in the group named special see Table

Returns an instance of singleprecisioninteger which

and also Table A have symb olic names for example the

corresp onds to the p osition of the instance of character in

newline character has the name new line and has the exter

the default character set

nal representation newline These sp ecial cases are the

characters named in Table A

Table A Sp ecial Character Syntax

A equal method

Name Syntax

alert alert

A Arguments

backspace backspace

delete delete

character an instance of character

1

formfeed formfeed

linefeed linefeed

character an instance of character

2

new line newline

return return

tab tab

A Result

space space

Each instance of character is converted to a integer and the

verticaltab verticaltab

two values are compared using The result of equal is the

rst argument if the result of is non If not the result

Any character which do es not have a name and thereby

is

an external representation dealt with by the ab ove cases is

represented by x followed by up to four hexadecimal dig

its The value of the hexadecimal numb er represents the

A copy method

p osition of the character in the current character set Exam

ples of such character literals are x and xabcd which

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

A Arguments

sition in the character set current at the time of read

ing or writing The syntax for the external representation of

character A character

characters is dened in Table A

NOTE At present this do cument refers to the current char

A Result

acter set but denes no means of selecting alternative character

Constructs and returns an instance of character whose

sets This is to allow for future extensions and implementation

value is the same under equal as the source

dened extensions which supp ort more than one character set

A character class

A genericprin method

The class of all instances of character

A genericwrite method

A characterp function

A Arguments

character Character to b e ouptut on stream

A Arguments

stream Stream on which character is to b e ouptut

obj Ob ject to examine

Programming Language EuLisp version

Table A Character Syntax

character extension characterextension charactername

charactername literalname j specialname j controlname j numeric

literalname alphanumeric j nonalpha

controlname controlextension literalname

specialname alert j backspace j delete j formfeed j linefeed j newline j

return j tab j space j verticaltab

characterextension

controlextension

numeric stringhex digit digit digit digit

A Result A Collections

The character character

The dened name of this mo dule is collection A col lection

is dened as an instance of one of string list vector

table or any userdened class for which a metho d is added

A Remarks

to any of the collection manipulation functions Collection

Output the interpretation of character on stream

do es not name a class and do es not form a part of the class

hierarchy

A genericwrite method

A emptyp generic function

A Arguments

A size generic function

character Character to b e ouptut on stream

stream Stream on which character is to b e ouptut

A member generic function

A Result

The character character

A do generic function

A Remarks

A map generic function

Output external representation of character on stream in the

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

A reduce generic function

A reduce generic function

A fill generic function

A catenate generic function

A filter generic function

Programming Language EuLisp version

A Comparing Ob jects

A eql function

The dened name of this mo dule is compare Four functions

for comparing ob jects are dened in EULISP of which is

A Arguments

sp ecically for comparing numeric values and eq eql and

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

following way obj

1

eq a b eql a b equal a b

obj

2

eq a b eql a b equal a b

A Result

If the class of obj and of obj is the same and is a sub class

1 2

A eq function

of number the result is that of comparing them under If

the class of obj and of obj is the same and is a sub class

1 2

of character the result is that of comparing them under

A Arguments

equal Otherwise the result is that of comparing them under

eq

obj an ob ject

1

obj an ob ject

2

A equal generic function

A Result

A Arguments

Compares obj and obj and returns t if they are the same

1 2

ob ject otherwise

obj

1

A Remarks

obj

2

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

might dier b etween pro cessors b ecause of implementation

A Result

choices ab out internal representations Therefore eq might

The result is determined by whichever of the metho ds dened

return t or for numb ers which are and similarly for char

here is applicable It is implementationde ned whether or

acters which are equal dep ending on the implementation

not equal will terminate on selfreferential structures

A generic function

A See also Class sp ecic sections which dene meth

o ds on copy

A Arguments

A equal method

number an instance of number

1

number an instance of number

2

A Arguments

A Result

object an ob ject

1

One of the arguments or

object an ob ject

2

A Remarks

A Result

Dened over all numb er typ es If b oth numb ers are of the

If the class of each instance of object is the same then the

same class they are compared according to the compari

result is the conjunction of the pairwise application of equal

son function for numb ers of that class If the two instances

to the contents of the slots of the arguments If not the result

are numerically equal the result is the rst argument a

is

non value If not the result is Metho ds are de

ned for the following classes singleprecisioninteger

variableprecisioninteger ratio float and complex

In the case of complex the result is determined by the con

junction of the pairwise applicatio n of to the real parts and

the imaginary parts

If the numb ers are not of the same class then one of the num

b ers is converted to the class of the other numb er according

to the proto col given in section A

A See also Class sp ecic sections which dene meth

o ds on copysingle precision integer and double oat

Programming Language EuLisp version

A Conversion source object The ob ject to b e converted

class class The class with which no converter function

The dened name of this mo dule is convert

is asso ciated

It may seem that the natural way to dene convert obj

targetclass is as a generic function sp ecializi ng on b oth pa

A Remarks

rameters However b ecause we want the b ehaviour to de

p end on the targetclass and not on the class of targetclass

Signalled by convert if there is no converter function for the

we would have to use class prototyp es as in up to version

given target class

or eql metho ds in order to make it work Neither is

desirable Some classes that might b e targets for conversion

for instance pair number cannot easily have prototyp es

A converter function

b ecause they cannot have direct instances eql metho ds if

they are desirable at all are to o great a complication for

level This suggests that it may have b een a mistake to

A Arguments

think in terms of multimetho ds Fortunately if we forget

them and consider classical metho ds a fairly reasonable so

targetclass The class whose set of conversion metho ds

lution app ears

is required

Advantages are that it is ob jectoriented in a natural way

A Result

there is no need for class prototyp es or eql metho ds and it

is asymmetric in the right direction the converter of a class

The accessor returns the converter function for the class

converts to rather than from instance of the class

targetclass The converter is a genericfunction with meth

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

Disadvantages are that metho ds are not inherited from more

Note that all converters dened here whose target class is

general target classesalthou gh this could b e argued the

string pro duce a string containing a representation of the

other way round to o

source ob ject as if it had output by write

Conversion b etween classes is provided by the function

convert which accesses a set of converter functions using

A setter converter setter

the target class the second argument to convert as a key

The resulting converter function is a generic function which

discriminates on the class of the ob ject which is to b e con

A Arguments

verted

targetclass The class whose converter function is to b e

replaced

A convert function

genericfunction The new converter function

A Arguments

A Result

obj An instance of some class to b e converted to an in

The new converter function The setter function replaces

stance of class

the converter function for the class targetclass by generic

function The new converter function must b e an instance

class The class to which obj is to b e converted

of genericfunction

A Result

A See also Converter metho ds from one class to an

Returns an instance of class which is equivalent in some class

other are dened in the section p ertaining to the source

sp ecic sense to obj which may b e an instance of any typ e

class

Calls the converter function asso ciated with the class 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 noapplicablemethod if

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

to an instance of class

A conversioncondition condition

This is the general condition class for all conditions arising

from conversion op erations

A noconverter conversioncondition

A Initoptions

Programming Language EuLisp version

Table A Metho ds for double precision oats

A Copying Ob jects

binaryplus

The dened name of this mo dule is copy

binarydifference

negate

binarytimes

A copy generic function

binarydivide

binarylt

abs

A Arguments

zerop

signum

obj An ob ject to b e copied

positivep

negativep

A Result

Constructs and returns a copy of the source which is the

same under some class sp ecic predicate as the source The

A Double Precision Floats

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

applicable metho d for obj

A doublefloat syntax

A See also Class sp ecic sections which dene meth

A oating p oint numb er has six forms of external repre

o ds on copy

sentation dep ending on whether either or b oth the whole

and the fractional part are sp ecied and on whether an ex

p onent is sp ecied In addition a p ositive oating p oint

A copy method

numb er is optionally preceded by a plus sign and a neg

ative oating p oint numb er is preceded by a minus sign

For example simpleoat simpleoat

A Arguments

simpleoat and with exp onents D

D D

object An ob ject the default metho d

The syntax for the external representation of double preci

A Result sion oating p oint literals is dened in Table A The rep

resentation used by write and prin is that based on simple

Constructs and returns an instance of the same class as the

oat without an exp onent namely sign simpleoat

source whose slot values are the same as those of the source

Finer control over the format of the output of oating p oint

under eql so that the resulting ob ject is the same under

numb ers is provided by some of the formatting sp ecications

equal as the source

of format see section A

The dened name of this mo dule is double Arithmetic op

erations for doublefloat are dened by metho ds to b e at

tached to the generic functions listed in Table A

A doublefloat class

The class of all instances of double precision oat

A doublefloatp function

A Arguments

obj Ob ject to examine

A Result

If obj is an instance of float the result is obj otherwise

The function float returns obj if obj is a sub class of float

and the doublefloatp returns obj if it is an instance of

doublefloat Otherwise b oth return

Programming Language EuLisp version

Table A Floating Point Syntax

oat sign uoat

sign f j g

uoat simpleoat exponent

simpleoat simpleoat j simpleoat j simpleoat

simpleoat udecimal oatseparator

simpleoat oatseparator udecimal

simpleoat udecimal oatseparator udecimal

oatseparator

exponent dexptmark sign udecimal

dexptmark fd j Dg

+

udecimal digit

digit f j j g

A Result

A mostpositivedoublefloat doubleoat

Given one argument returns the greatest integer value whose

magnitude is less than or equal to x Given two arguments

with an integer value as the second to sp ecify precision re

A Remarks

turns a oating p oint numb er which is the result of zeroing

The value of mostpositivedoublefloat is that p ositive

out the low n pr ecision digits where n is the numb er of

double precision oating p oint numb er closest in value to

digits of precision provided by the representation It is an

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

error if pr ecision is greater than n

vides

A truncate method

A leastpositivedoublefloat doubleoat

A Remarks

A Remarks

Implements truncate for doublefloat

The value of leastpositivedoublefloat is that p ositive

double precision oating p oint numb er closest in value to

but not equal to zero that the pro cessor provides This

value is the same as the result of succ

A round generic function

A leastnegativedoublefloat doubleoat

A Arguments

oat An instance of float

A Remarks

The value of leastnegativedoublefloat is that negative

precision A single precision integer

double precision oating p oint numb er closest in value to

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

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

A Result

negative zero This value is the same as the result of pred

Given one argument returns the integer whose value is clos

est to x except in the case when x is exactly halfway b e

tween two integers when it is rounded to the one that is

A mostnegativedoublefloat doubleoat

even Given two arguments with an integer value as the

second to sp ecify precision returns a oating p oint numb er

which is the result of zeroing out the low n pr ecision

A Remarks

digits where n is the numb er of digits of precision provided

The value of mostnegativedoublefloat is that negative

by the representation The numb er of digits of precision and

double precision oating p oint numb er closest in value to

the radix of the precision are implementationd ened val

but not equal to negative innity that the pro cessor pro

ues If the resulting value is exactly halfway b etween two

vides

pr ecisiondigit oating p oint numb ers the result is the one

with the even least signicant digit It is an error if pr ecision

is greater than n

A truncate generic function

A Arguments

A round method

oat An instance of float

A Remarks

precision A single precision integer

Implements round for doublefloat

Programming Language EuLisp version

A Result

A floor generic function

Returns an instance of singleprecisioninteger whose

value is closest to that of the oating p oint source

This is the same function as round without sp ecifying

A Arguments

the second argument An error is signaled condition

integerconversionoverflow if the oating p oint num

oat An instance of float

b er cannot b e represented as a single precision integer

A integerconversionoverflow

A Result

conversioncondition

Computes the greatest integer value which is less than or

equal to oat

A Initoptions

source double The double oat to b e converted

A floor method

A Remarks

A Remarks

Signalled by the double metho d of converter spint if

Implements floor for doublefloat

the magnitude of the double oat is greater than can b e

reprented by a single precision integer

A ceiling generic function

A copy method

A Arguments

A Arguments

oat An instance of float

doubleoat A double precision oat

A Result

A Result

Constructs and returns an instance of doublefloat whose

Computes the least integer value that is greater than or equal

value is the same under as the source

to oat

A genericprin method

A ceiling method

A genericwrite method

A Remarks

Implements ceiling for doublefloat

A Arguments

x The double oat to b e output on stream

A converter string method

stream The stream on which the representation is to b e

output

A Arguments

A Result

doubleoat A double precision oat

The double oat supplied as the rst argument

A Result

A Remarks

Constructs and returns a string the characters of which cor

Output the external representation of x on stream as de

resp ond to the external representation of the instance of

scrib ed in the intro duction to this section namely sign

doublefloat

simpleoat Finer control over the format of the output of

oating p oint numb ers is provided by some of the formatting

sp ecications of format see section A

A converter singleprecisioninteger method

A Arguments

doubleoat A double precision oat

Programming Language EuLisp version

A Elementary Functions

A atan generic function

The dened name of this mo dule is elementaryfunctions

The contents of this mo dule are dened as if all the num

A Arguments

b er classes of EULISP exist including complex Dep end

ing on the level of conformance of a given implementation

only the metho ds for the numb er classes dened at the level

z A numb er

of the pro cessor need b e supplied to provide a compliant

elementaryfunctions library mo dule

A Result

atan returns the arc tangent of its argument The unit of the

argument is radians Metho ds are dened for the appropriate

A pi doubleoat

sub classes of integer and float and for ratio and complex

The metho ds for integer and ratio co erce their argument

to float and then compute the result The metho d for float

A Remarks

pro duces a float result the metho d for complex pro duces a

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

complex result

diameter stored to double precision oating p oint accuracy

A atan generic function

A sin generic function

A Arguments

A cos generic function

x x Two numb ers

1 2

A tan generic function

A Result

atan returns the arc tangent of the quantity x x treating

1 2

A Arguments

the case x correctly Metho ds are dened for integer

2

integer float float and ratio ratio If the argu

z A numb er

ments are not of the same sub class of number but in the

set given ab ove the lower one is co erced to the class of the

higher according to the proto col for the level b eing used see

gure A The metho ds for integer and ratio co erce their

A Result

arguments to float and then compute the result A float

sin returns the sine of its argument cos the cosine and tan

result is returned

the tangent The unit of the argument is radians Metho ds

are dened for the appropriate sub classes of integer and

The range of the realpart of the values returned by atan

float and for ratio and complex The metho ds for integer

and atan is pi pi

and ratio co erce their argument to float and then compute

the result The metho ds for float pro duce a float result

the metho ds for complex pro duce a complex result

A exp generic function

A Arguments

A acos generic function

z A numb er

A asin generic function

A Result

A Arguments

exp returns e raised to the p ower of x where e is the base

of the natural logarithms Metho ds are dened for the ap

z A numb er

propriate sub classes of integer and float and for ratio

and complex The metho ds for integer and ratio co erce

their argument to float and then compute the result The

metho d for float pro duces a float result the metho d for

A Result

complex pro duces a complex result

acos returns the principal arc cosine and asin the princi

pal arc sine of its argument The unit of the result is radi

ans Metho ds are dened for the appropriate sub classes of

A log generic function

integer and float and for ratio and complex The meth

o ds for integer and ratio co erce their argument to float

and then compute the result The metho ds for float pro

duce a float result when z otherwise a complex

A log generic function

result The metho ds for complex pro duce a complex result

Programming Language EuLisp version

A Result

A log generic function

expt returns the principal value that results from raising z

1

to the p ower z The complexity in the denition of expt

2

stems from the dierent combinations of argument classes

A Arguments

and what might b e a reasonable result class for a given pair of

argument classes For the purp ose of dening the b ehaviour

z A numb er

of this function the numb er classes are considered to form a

tower as follows

A Result

complex

complexratio log returns the logarithm of z to the base of the natural log

complexinteger arithms log returns the logarithm of z to base log

float returns the logarithm of z to base The result can b e

ratio either float or complex Metho ds are dened for the ap

integer propriate sub classes of integer and float and for ratio

and complex The metho ds for integer and ratio co erce

their argument to float and then compute the result The

where the classes corresp ond to and approximate the ab

metho ds for float pro duce a float result when z is real

stract mathematical ob jects C Qi Z i R Q Z For each

and p ositive otherwise a complex result The metho ds for

argument class combination the entry in Table A shows

complex pro duce a complex result

the lowest class in which the result might b e expressed In

this sense we dene the lower b ound class in which the result

can o ccur for a given pair of arguments The result of expt

should b e in the lowest class p ossible for a given argument

A sqrt generic function

combination without loss of information

A Arguments

A sinh generic function

z A numb er

sqrt returns the principal square ro ot of z

A cosh generic function

A sqrt method

A tanh generic function

A Arguments

A asinh generic function

integer An integer

A acosh generic function

A Result

The metho d for integer returns an integer if the argument is

A atanh generic function

a p ositive p erfect square a gaussian integer if the argument

is a negative p erfect square otherwise a float is returned

if the argument is p ositive or a complex if the argument is

A Arguments

negative

z A numb er

A sqrt method

A Result

These functions compute the hyp erb olic sine cosine tan

A Arguments

gent arc sine arc cosine and arc tangent functions The

result can b e float or complex Metho ds are dened for the

doubleoat A double oat

appropriate sub classes of integer and float and for ration

and complex The metho ds for integer and rational co erce

their argument to float and then compute the result For

A Result

the sine cosine tangent and arc sine the metho ds for float

The metho d for doublefloat returns a doublefloat if the

pro duce a float result For the arc cosine the metho d for

argument is nonnegative and a complex if it is not

float pro duces a float if z otherwise a complex For

the arc tangent the metho d for float pro duces a float if

z otherwise a complex

A expt generic function

All metho ds pro duce a complex result for a complex argu

ment

A Arguments

NOTEmore detailed specication is required for this

z z Two numb ers

1 2

library module in particular with respect to the han

Programming Language EuLisp version

Table A expt result classes

Base Exp onent Class

Class integer ratio float complex

integer integer integer float complex

ratio integer integer float complex

float float float float complex

complexinteger integer integer complex complex

complexratio integer integer complex complex

complex complex complex complex complex

d ling of negative and the stating of branches and A FormattedIO

cuts

The dened name of this mo dule is formattedio

A scanmismatch streamcondition

A Initoptions

formatstring string The value of this option is the for

mat 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 includin g the ob ject that caused

the condition to b e signaled

A Remarks

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

not agree with the data received from stream

A scan function

A Arguments

formatstring A string containing format directives

stream A stream from which input is to b e taken

A Result

Returns a list of ob jects which have b een read

A Remarks

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 campatible with the sp ecied directive The second

optional argument sp ecies a stream from which to take in

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

which is the value of calling standardinputstream Scan

returns a list of the values read in

a any accept any ob ject

b binary an integer in binary format

c character a single character

d decimal an integer decimal format

Programming Language EuLisp version

mne a xedformat oatingp oint numb er in FOR nr radix the integer argument is output in radix n

TRAN E format

s sexpression uses write to output the ob ject

mnf an exp onentialformat oatingp oint numb er

in FORTRAN F format t tab output sucient spaces to reach the next

tabstop

mng a generalized oatingp oint numb er in either

xed or exp onential format either xedformat or exp o x hexadecimal the integer argument is output in

nential notation as appropriate hexadecimal format

o o ctal an integer in o ctal format newline output a newline character

conditional newline output a newline charac

r radix an integer in sp ecied radix format

ter if it cannot b e determined that the output stream is

at the b eginning of a fresh line

x hexadecimal an integer in hexadecimal format

page separator output a page separator

newline matches a newline character in the

input

tilde output a tilde

A format function

A Arguments

stream One of t or an instance of stream

formatstring A string containing format directives

obj

A Result

Returns a list of unconsumed objs

A Remarks

Has sideeect of printing according to formatstring If

stream 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 exception of those prexed by tilde

graphic representation as follows

a any use prin to output the ob ject

b binary the integer argument is output in binary

format

c character the next argument is displayed as a

character

d decimal the integer argument is output in deci

mal format

mne xedformat oatingp oint the oatingp oint

argument is output in FORTRAN E format

mnf exp onential oatingp oint the oatingp oint

argument is output in FORTRAN F format

mng generalized oatingp oint output the

oatingp oint argument using either xedformat or ex

p onential notation as appropriate

o o ctal the integer argument is output in o ctal

format

Programming Language EuLisp version

A The empty list A Remarks

Output the external representation of the empty list on

The dened name of this mo dule is null The empty list is

stream as describ ed ab ove

disjoint from the class pair The combination of null

and pair allows the creation of prop er lists since a prop er

list is one whose last pair contains the empty list in its cdr

eld

A syntax

A Remarks

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

has as its external representation an op en parenthesis fol

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

denote the b o olean value false

A null class

The class whose only instance is the empty list denoted

A null function

A Arguments

obj Ob ject to examine

A Result

Returns t if obj is the empty list otherwise

A length method

A Arguments

nul l The empty list

A Result

Returns zero

A genericprin method

A genericwrite method

A Arguments

nul l The empty list

stream The stream on which the representation is to b e

output

A Result

The empty list

Programming Language EuLisp version

A Numb ers

A floatp function

The dened name of this mo dule is number The naming

conventions describ ed in section are applied in the following

denitions A Arguments

Numb ers can take on many forms with unusual prop erties obj Ob ject to examine

sp ecialized for dierent tasks but two classes of numb er nor

mally suce for the ma jority of needs Thus at level only

A Result

a limited set of numb er classes are dened

If the class of obj is a sub class of float the result is obj

In Figure A is an example of what the initial numb er class

otherwise

hierarchy for level might lo ok like The inheritance rela

tionships by this diagram are part of this denition but it

is not dened whether they are direct or not For example

A arithmeticcondition condition

integer and float are not necessarily direct sub classes of

number and the class of each numb er class might b e a sub

class of numberclass Since there are only two concrete

A Initoptions

numb er classes at level co ercion is simple as shown in g

ure A Any level version of a library mo dule for example

operator object The op erator which signalled the con

elementaryfunctions need only dene metho ds for these

dition

two classes

operandlist list The op erands passed to the op erator

A number class

A Remarks

This is the general condition class for conditions arising from

The abstract class which is the sup erclass of all numb er

arithmetic op erations

classes

A equal method

A numberp function

A Arguments

A Arguments

number an instance of number

1

obj Ob ject to examine

number an instance of number

2

A Result

If the class of obj is a sub class of number the result is obj

A Result

otherwise

If the class of number and number is the same sub class of

1 2

number the result of equal is the result of If the instances

are not of the same sub class of number the result is

A integer class

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

A function

b ers

A Arguments

A integerp function

z z A sequence of instances of number

1 2

A Arguments

A Result

obj Ob ject to examine

Computes the sum of the arguments using the generic func

tion binaryplus Given zero arguments returns of

class integer One argument returns that argument The

A Result

arguments are combined leftasso ciatively

If the class of obj is a sub class of integer the result is obj

otherwise

A function

A float class

A Arguments

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

z z A nonempty sequence of instances of number

1 2

numb ers

Programming Language EuLisp version

Figure A Level numb er class hierarchy and co ercion chart

number numberclass singleprecisioninteger

float numberclass doublefloat

doublefloat numberclass

integer numberclass

singleprecisioninteger numberclass

A Result A Result

Determines whether the sequence of numb ers x up to

Computes the result of subtracting successive arguments 1

x is strictly decreasing according to the generic function

from the second to the lastfrom the rst using the generic

n

binarylt

function binarydifference Zero arguments is an error

One argument returns the negation of the argument The

arguments are combined leftasso ciativel y

A function

A function

A Arguments

x x A sequence of at least two instances of number

1 2

A Arguments

z z A sequence of instances of number

1 2

A Result

Determines whether the sequence of numb ers x up to x is

1 n

increasing according to the generic function binaryle

A Result

Computes the pro duct of the arguments using the generic

function binarytimes Given zero arguments returns

A function

of class integer One argument returns that argument The

arguments are combined leftasso ciativel y

A Arguments

A function

x x A sequence of at least two instances of number

1 2

A Result

A Arguments

Determines whether the sequence of numb ers x up to x is

1 n

z z A nonempty sequence of instances of number

1 2

decreasing according to the generic function binaryge

A Result

A max function

Computes the result of dividin g the rst argument

by its succeeding arguments using the generic function

binarydivide Zero arguments is an error One argument

A Arguments

computes the recipro cal of the argument

x x A nonempty sequence of instances of

1 2

number

A function

A Result

Determines the maximal element of the numb ers x up to

1

A Arguments

x using the generic function binarylt Zero arguments is

n

an error One argument returns x

1

x x A sequence of at least two instances of number

1 2

A Result

A min function

Determines whether the sequence of numb ers x up to

1

x is strictly increasing according to the generic function

n

A Arguments

binarylt

x x A nonempty sequence of instances of

1 2

number

A function

A Result

A Arguments

Determines the minimal element of the numb ers x up to x

1 n

using the generic function binarylt Zero arguments is an

x x A sequence of at least two instances of number

1 2

error One argument returns x

1

Programming Language EuLisp version

A gcd generic function A positivep generic function

A Arguments

A Arguments

x An instance of number

z z A nonempty sequence of instances of num

1 2

b er

A Result

Compares x against the zero element of the class of x using

A Result

the generic function binarylt

Computes the greatest common divisor of z up to z using

1 n

the generic function binarygcd Zero arguments is an error

One argument returns z

1

A negativep generic function

A lcm generic function

A Arguments

x An instance of number

A Arguments

q q A nonempty sequence of instances of

1 2

A Result

number

Compares x against the zero element of the class of x using

the generic function binarylt

A Result

Computes the least common multiple of q up to q using

1 n

A binaryplus generic function

the generic function binarylcm Zero arguments is an error

One argument returns q

1

A Arguments

z z Two instances of number

A abs generic function

1 2

A Result

A Arguments

Compute the sum of z and z

1 2

z An instance of number

A binarydifference generic function

A Result

Compute the absolute value of z

A Arguments

z z Two instances of number

1 2

A zerop generic function

A Result

A Arguments

Compute the dierence of z and z

1 2

x An instance of number

A negate generic function

A Result

Compares z with the zero element of the class of z using the

A Arguments

generic function

z An instance of number

A signum generic function

A Result

Compute the additive inverse of x

A Arguments

x An instance of number

A binarytimes generic function

A Result

A Arguments

If zerop x then returns x Otherwise returns the result of

z z Two instances of number

converting to the class of x with the sign of x

1 2

Programming Language EuLisp version

A Result A Pairs and Lists

Compute the pro duct of z and z

1 2

The dened name of this mo dule is pair

A binarydivide generic function

A pair syntax

A Arguments

A pair is written as obj obj where obj is the car and

1 2 1

obj is the cdr There are two sp ecial cases in the print

2

z z Two instances of number

1 2

representation of pair If obj is the empty list then the

2

pair is written as obj If obj is an instance of pair

1 2

A Result

then the pair is written as obj obj obj where obj

1 3 4 3

is the car of obj and obj is the cdr with the ab ove rule

2 4

Compute the ratio of z and z If the divisor is the

1 2

for the empty list applying By induction a list of length

zero element of the class an error is signaled condition

n is written as obj obj obj with the ab ove rule

1 n1 n

divisionbyzero

for the empty list applying The representations of obj and

1

obj are determined by the external representations dened

2

in other sections of this denition see characterA

A binarylt generic function

doublefloatA nullA spintA

stringA symbolA and vectorA as

well as instances of pair itself The syntax for the external

A Arguments

representation of pairs and lists is dened in Table A

x x Two instances of number

1 2

A pair class

A Result

Compare x with x returning t if x precedes x according

1 2 1 2

The class of all instances of pair Instances of the class

to the ordering metho d of the class of higher class of x and

1

pair also known informally as a dotted pair is a tuple

x

2

whose slots are called for historical reasons car and cdr

Pairs are created by the function cons and the slots are ac

cessed by the functions car and cdr The ma jor use of pairs

A binarygcd generic function

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

ned as either the empty list denoted by or a pair whose

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

A Arguments

which is not a list see Table A

q q Two instances of number

1 2

A consp function

A Result

Compute the greatest common divisor of q and q

1 2

A Arguments

obj Ob ject to examine

A binarylcm generic function

A Result

A Arguments

Returns obj if obj is a sub class of pair otherwise

q q Two instances of number

1 2

A atom function

A Result

Compute the lowest common multiple of q and q

1 2

A Arguments

obj Ob ject to examine

A Result

If obj is not an instance pair obj is returned otherwise

A cons function

A Arguments

Programming Language EuLisp version

Table A Pair and List Syntax

pair pairbegin obj pairseparator obj pairend

1 2

pairbegin

pairseparator whitespace whitespace

pairend

list emptylist j listhead

emptylist

listhead pairbegin obj listtail

1 1

listtail impropertail j pairend j obj listtail

i i i i+1

impropertail pairseparator obj

i i

obj An ob ject to b e stored in the car eld of the result A Remarks

1

pair

Note that if obj is not then the use of setter cdr will

make pair an improp er list It is an error to apply these

obj An ob ject to b e stored in the cdr eld of the result

2

setter functions to anything other than a pair

pair

A converter string method

A Result

Allo cates a new pair initiali zed to obj and obj

1 2

A Arguments

pair A list of characters

A car function

A Result

Constructs and returns a string the characters of which cor

A cdr function

resp ond to the characters comprising the rst elements of the

toplevel pairs of the instance of pair It is an error if the

source is not a prop er list An error is signaled condition

A Arguments

notacharacter unless all of those elements are instances

of the class character

pair An instance of pair

A notacharacter conversioncondition

A Result

Given an instance of pair such as the result of cons obj

1

A Initoptions

obj the function car returns obj and cdr returns obj

2 1 2

source list The list of ob jects to b e converted into a

string

A Remarks

It is an error to apply car or cdr functions to anything other

A Remarks

than a pair The empty listwritten is not a pair car

and cdr is an error

Signalled by the pair metho d of converter string unless

the source list contains only characters

A setter car setter

A converter string method

A setter cdr setter

A Arguments

pair A list of characters

A Arguments

pair An instance of pair

A Result

Constructs and returns a vector the elements of which corre

obj An ob ject

sp ond to rst elements of the toplevel pairs in the instance

of pair It is an error if the source is not a prop er list

A Result

Given an instance of pair such as the result of cons obj

1

A equal method

obj the function setter car replaces obj with obj and

2 1

setter cdr replaces obj with obj The setter functions

2

A Arguments return obj

Programming Language EuLisp version

pair an instance of pair

1

A copyalist function

pair an instance of pair

2

A Arguments

A Result

alist A prop er list of pairs

The result is the conjunction of the pairwise applicatio n of

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

A Result

Constructs and returns a copy of the list alist copying b oth

the toplevel pairs and the second level pairs the asso cia

A copy method

tions

A Arguments

A copylist function

pair A pair

A Arguments

A Result

list A listprop er or improp er

Constructs and returns an instance of pair whose elements

are the same as those of the source under eql so that the

resulting pair is the same under equal as the source

A Result

Constructs and returns a copy of list by copying the toplevel

pairs only

A list function

A copytree function

A Arguments

obj obj A sequence of ob jects

1 n

A Arguments

list A listprop er or improp er

A Result

Allo cates a set of pairs each of which has b een initiali zed with

A Result

obj in the car eld and the pair whose car eld contains

i

Constructs and returns a copy of list by copying the toplevel

obj in the cdr eld Returns the pair whose car eld

i+1

pairs and then op erates recursively on each of those pairs

contains obj

1

thus copying every pair in list

A length method

A genericprin method

A Arguments

A genericwrite method

pair A pair

A Arguments

A Result

pair The pair to b e output on stream

Returns the count of the numb er of toplevel pairs in list

stream The stream on which the representation is to b e

output

A Remarks

The list need not b e a prop er list

A Result

The pair supplied as the rst argument

A Examples

A Remarks

Output the external representation of pair on stream as de

scrib ed in the intro duction to this section Both metho ds

length result is

call the generic function again to pro duce the external rep

length cons result is

resentation of the car and cdr slots of the pair

length cons result is

length cons cons result is

Programming Language EuLisp version

Table A Metho ds for single precision integers

A Result

Returns obj if obj is an instance of spint

binaryplus

binarydifference

negate

binarytimes

A evenp generic function

binarylt

binarygcd

A Arguments

binarylcm

abs

number An instance of number

zerop

signum

positivep

A Result

negativep

If number is an instance of a suitable sub class of number

returns t if the remainder from dividing i by two is zero

otherwise

A Single Precision Integers

The dened name of this mo dule is spint

A evenp method

A singleprecisioninteger syntax A Remarks

Implements evenp for single precision integers

A p ositive integer is has its external representation as a se

quence of digits optionally preceded by a plus sign A nega

A oddp generic function

tive integer is written as a sequence of digits preceded by a

minus sign For example

A Arguments

Integer literals have an external representation in any base

up to base For convenience base base and base

number An instance of number

have distinguis hed notationsb o and x resp ectively

For example b o and xd all

denote the same value

A Result

If number is an instance of a suitable sub class of number

The general notation for an arbitrary base is base r where

returns t if the remainder from dividing i by two is non

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

zero otherwise

amples may also b e written r r

r rd or rya The syntax for the external

representation of integer literals is dened in Table A

A oddp method

NOTE At present this do cument do es not dene a class inte

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

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

Implements oddp for single precision integer

variableprecisioninteger with the shorter alias vpint The

syntax given here is applicable to b oth single and variable preci

sion integers

A divisionbyzero arithmeticcondition

The class is named singleprecisioninteger but it is

also called by the shorter alias spint Arithmetic op era

Signalled by any of quotient remainder and modulo if their

tions for singleprecisioninteger are dened by metho ds

second argument is zero

to b e attached to the generic functions listed in Table A

A quotient generic function

A singleprecisioninteger class

A Arguments

The class of all instances of single precision integers Also

named spint

integer integer Two instances of integer

1 2

A Result

A singleprecisionintegerp function

If number is an instance of a suitable sub class of number

returns q by solving the equation number number q r

1 2

A Arguments

where r lies b etween zero inclusive and the number

2

sig nnumber exclusive Sign combination for quotient

1

obj Ob ject to examine

is as follows

Programming Language EuLisp version

Table A Integer Syntax

integer sign uinteger

sign f j g

uinteger ubinary j uoctal j udecimal j uhexadecimal j uintegerwithbase

+

ubinary extension fb j Bg digit

+

uoctal extension fo j Og digit

+

udecimal digit

+

uhexadecimal extension fx j Xg digit

+

uintegerwithbase extension udecimal fr j Rg digitudecimal

digit f j g

digit f j j g

digit f j j j fa j Agg

digit f j j j fa j Ag j j fy j Ygg

digit f j j j fa j Ag j j fy j Yg j fz j Zgg

integ er integ er

2 2

A Arguments

integ er q q

1

i i Two instances of integer

integ er q q

1 2

1

A Result

A quotient method

If i is an instance of a suitable sub class of integer returns

m by solving the equation integ er integ er q r

1 2

A Remarks

where r lies b etween zero inclusive and the integ er

2

sig ninteg er exclusive and m is constrained by m

Implements quotient for single precision integer An error is

1

jq j Sign combination for modulo is given in Table A

signalled condition divisionbyzero if integer is zero

2

A remainder generic function

A modulo method

A Remarks

i i i

1 2

Implements modulo for single precision integer An error is

signalled condition divisionbyzero if integer is zero

2

A Arguments

integer integer Two instances of integer

1 2

A mostpositivesingleprecisioninteger

singleprecisioninteger

A Result

If integer is an instance of a suitable sub class of integer

A Remarks

returns r by solving the equation integ er integ er q

1 2

r where r lies b etween zero inclusive and the integ er

2

This is an implementationd ened constant A conform

sig ninteg er exclusive Sign combination for remainder

1

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

is as follows

to and greater than or equal to the value of

maximumvectorindex

integ er integ er

2 2

integ er r r

1

integ er r r

1

A mostnegativesingleprecisioninteger

singleprecisioninteger

A remainder method

A Remarks

This is an implementationde ned constant A conforming

A Remarks

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

Implements remainder for single precision integer An er

ror is signalled condition divisionbyzero if integer is

2

zero

A converter character method

A modulo generic function

A Arguments

singleprecisioninteger A singleprecisi oni nteger

i i i

1 2

Programming Language EuLisp version

Table A Sign combination in modulo

integ er integ er

2 2

integ er r remainderi remainderi i i

1 2 1 2 2

integ er remainderi remainderi i i r

1 2 1 2 2

A Result

A genericprin method

Returns an instance of character whose p osition in the

default character set corresp onds to that sp ecied by the

instance of integer An error is signaled condition

A genericwrite method

cannotconverttocharacter if the sp ecied p osition

do es not exist

A Arguments

A nosuchcharacter conversioncondition

i The single precision integer to b e output on stream

stream The stream on which the representation is to b e

Signalled by the conversion metho d from spint to

output

character if there is no character in the defaul character

set corresp onding to the p osition sp ecied by the integer

A Result

The single precision integer supplied as the rst argument A See also converter character

A Remarks

A converter string method

Output external representation of i on stream in decimal as

describ ed in the intro duction to this section

A Arguments

singleprecisioninteger A singleprecisi oni nteger

A Result

Constructs and returns a string the characters of which cor

resp ond to the external representation of the instance of

singleprecisioninteger in decimal

A converter doublefloat method

A Arguments

singleprecisioninteger A single precision integer

A Result

Returns an instance of doublefloat whose value is the

oating p oint approximation to the single precision integer

source

A copy method

A Arguments

singleprecisioninteger A single precision integer

A Result

Constructs and returns

an instance of singleprecisioninteger whose value is

the same under as the source

Programming Language EuLisp version

Table A Initial stream class hiearchy

A filestreamp function

stream streamclass

filestream stream

streamproperties streampropertiesclass

A Arguments

streamdirection streamproperties

inputstream

obj ob ject to examine

outputstream

iostream

streamunit streamproperties

A Result

The supplied argument if it is an instance of filestream

streampositionablep streamproperties

otherwise

A Streams

A streamcondition condition

The dened name of this mo dule is stream

This is the general condition class for conditions arising from

op erations on streams

A stream class

A syntaxerror condition

The abstract class of all instances of stream

This is the general condition class for conditions arising from

The initial class hiearchy of streams and stream prop erties

using the function read

is shown in Table A

A inputstreamp function

A filestream class

The class of all instances of filestream This is the only

A Arguments

sub class of stream dened at level

obj Ob ject to examine

A Initoptions

A Result

direction direction An instance of

The supplied argument if one of its stream direction is an

streamdirection

instance of inputstream otherwise

transactionunit unit An instance of streamunit

or characterindicating a character stream or

A outputstreamp function

spintindicating a binary stream

positionable boolean Either or non

A Arguments

obj Ob ject to examine

A inputstream streamdirection

A Result

Used to indicate stream direction when making instances of

The supplied argument if one of its stream direction is an

filestream

instance of outputstream otherwise

A iostream streamdirection

A iostreamp function

Used to indicate stream direction when making instances of

A Arguments

filestream

obj Ob ject to examine

A ouputstream streamdirection

A Result

Used to indicate stream direction when making instances of The supplied argument if one of its stream direction is an

filestream instance of outputstream otherwise

Programming Language EuLisp version

A Result

A characterstreamp function

A stream

NOTE version In a future version it is forseen that a

A Arguments

more general approach to le naming will b e adopted such as the

pathnames of Common Lisp At that time it will b e appropriate

to add another metho d to open where the hand le argument is

obj Ob ject to examine

an instance of pathname Thus at present no implementation

indep endent way of naming les is provided

A Result

The supplied argument if one of its prop erties is an instance

A openp generic function

of characterstream otherwise

A Generic Arguments

A binarystreamp function

stream stream A stream

A Arguments

A Result

A non value if stream is op en otherwise

obj Ob ject to examine

A openp method

A Result

The supplied argument if one of its prop erties is an instance

A Sp ecialized Arguments

of binarystream otherwise

stream filestream A le stream

A open generic function

A Result

A non value if stream is op en otherwise

A Generic Arguments

stream stream The stream to b e op ened

A close generic function

hand le object The name of the ob ject internal or

external to the pro cessor

A Generic Arguments

initlist list A list of initiali zati on options

stream stream A stream

A Result

A Result

If stream is op en it is closed Returns

A stream

A close method

A open method

A Sp ecialized Arguments

A Sp ecialized Arguments

stream filestream A le stream

stream filestream The stream to b e op ened

hand le string The name of the le to b e op enend

A Result

If stream is op en it is closed Returns

initlist list A list of initiali zati on options as fol

lows

A writeunit generic function

direction direction An instance of

streamdirection

A Generic Arguments

transactionunit unit An instance of

streamunit

stream stream A stream

positionable boolean Either or non

object object An ob ject

Programming Language EuLisp version

A Result

A prin function

The object is written to stream Returns

A Arguments

A writeunit method

object

A Sp ecialized Arguments

stream

stream filestream A le stream

A Result

character character A character

If stream is op en object is output on stream

A Result

A genericprin generic function

If the transaction unit of stream is character the char

acter is written to stream Returns

A Generic Arguments

A writeunit method

stream stream The stream on which object is to b e

output

A Sp ecialized Arguments

object object The ob ject to b e output on stream

stream filestream A le stream

A Result

integer spint A single precision integer

If stream is op en object is output on stream

A Result

A See also Sections on the dierent classes de

If the transaction unit of stream is spint the integer is

ned at level for metho ds o on this function

written to stream Returns

A readunit generic function

A write function

A Generic Arguments

A Arguments

stream stream A stream

object

A Result

stream

The next ob ject input from stream The class of the ob ject

is restricted to that of the transaction unit of the stream

A Result

If stream is op en object is output on stream

A readunit method

A Sp ecialized Arguments

A genericwrite generic function

stream filestream A le stream

A Generic Arguments

A Result

stream stream The stream on which object is to b e

output

An ob ject representing the next transaction unit input from

stream The class of this ob ject is determined by the trans

object object The ob ject to b e output on stream

action unit prop erty of stream

A Result

A read function

If stream is op en object is output on stream

A Arguments

A See also Sections on the dierent classes de

stream An instance of stream

ned at level for metho ds o on this function

Programming Language EuLisp version

A Result

A flush generic function

An ob ject corresp onding to the next element pro cessed by

read from stream

A Generic Arguments

A Remarks

stream stream A stream

When a syntax error is detected an error is signaled condi

tion syntaxerror The p osition of the stream b eing read

is undened after such an error o ccurs

A Result

Any remaining buered output to stream is forced out

A genericread generic function

A flush method

A Generic Arguments

A Sp ecialized Arguments

stream stream A stream

stream filestream A le stream

prototype object An ob ject

A Result

A Result

Any remaining buered output to stream is forced out

The next ob ject input from stream

A wait method

A genericread method

A Sp ecialized Arguments

A Sp ecialized Arguments

stream filestream The filestream on which

to wait

stream filestream A le stream

timeout object The timeout p erio d

prototype object An ob ject

A Result

A Result

Returns stream if stream is an inputstream or an iostream

and has input available

The next ob ject input from stream What is protptype for

A See also wait

A peekunit generic function

A Generic Arguments

stream stream A stream

A Result

The next ob ject that could b e input from stream The class

of the ob ject is restricted to that of the transaction unit of

the stream

A peekunit method

A Sp ecialized Arguments

stream filestream A le stream

A Result

An ob ject representing the next transaction unit that o culd

b e input from stream The class of this ob ject is determined

by the transaction unit prop erty of stream

Programming Language EuLisp version

Table A Examples of string literals

A Strings

Example Contents

The dened name of this mo dule is string

anb a newline and b

c c and

x x followed by space

xabcde xabcd followed by e

A string syntax

xx x followed by x

x x followed by

xabcg xabc followed by g

String literals are delimited by the stringbegin and string

xabc xab followed by c

end glyphs which are b oth dened as the glyph called quo

tation mark For example abcd

Sometimes it might b e desirable to include string delimiter

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

A string class

ll this need The stringescape glyph is dened as reverse

solidus String escaping can also b e used to include cer

tain other characters that would otherwise b e dicult to de

The class of all instances of string

note The set of named sp ecial characters see section A

have a particular syntax to allow their app earance in strings

A Initoptions

To allow arbitrary characters to app ear in strings the argu

ment to the hexinsertion digram is an integer denoting the

size spint The numb er of characters in the string

p osition of the character in the current character set In the

Strings are zerobased and thus the maximum index is

case of hex insertion each d denotes any hexadecimal digit

size If not supplied the size is zero

A summary of stringescape digrams app ears in Table A

Some examples of string literals app ear in Table A

fill character A character with which to initial ize the

string If not supplied the ll character is x

Table A String escap e digrams

Digram Interpretation

A stringp function

a alert

b backspace

d delete

A Arguments

f formfeed

l linefeed

obj Ob ject to examine

n new line

r return

t tab

A Result

v verticaltab

Returns obj if obj is an instance of a sub class string other

stringbegin

wise

stringend

stringescape

xdddd hexinsertion

A stringref function

The syntax for the external representation of strings is de

ned in Table A

A setter stringref setter

NOTE At present this do cument refers to the current char

acter set but denes no means of selecting alternative character

A Arguments

sets This is to allow for future extensions and implementation

dened extensions which supp ort more than one character set

string Source string

The function write outputs a rereadable form of any es

n An instance of singleprecisioninteger

cap ed characters in the string For example anb input

notation is the string containing the characters newline

character An instance of character for setter

a and b The function write pro duces anb

whilst prin pro duces

A Result

a

Access and up date elements of a string It is an error if n

b

is outside the range zero to one less than the length of the

string

Characters which do not have a glyph asso ciated with their

p osition in the character set are output as a hex insertion

in which all four hex digits are sp ecied even if there are

A converter pair method

leading zeros The function prin outputs the interpretation

of the characters according to the denitions in section A

A Sp ecialized Arguments and omits the stringbegin and stringend characters

Programming Language EuLisp version

Table A String Syntax

string stringbegin stringchar stringend

stringbegin

stringchar normalchar j escapediphthong

stringend

normalchar anycharacterbeginendorescapeexcepted

escapediphthong stringescape stringinsertion

stringescape

stringinsertion stringbegin j stringend j stringescape j hexinsertion j stringnew line

hexinsertion stringhex digit digit digit digit

stringnew line n j N

stringhex x j X

string string A string to b e converted to a list of

characters

A stringlt function

A Result

A Arguments

Constructs and returns a prop er list of characters the ele

string string Two instances of string

1 2

ments of which corresp ond to the characters in the external

representation of the instance of string as would b e gener

ated by write

A Result

If the sequence of characters in string is alphab etical l y less

1

than that in string returns t else

2

A equal method

A stringslice function

A Sp ecialized Arguments

string string an instance of string

1

A Arguments

string string an instance of string

2

string An instance of string

start An instance of singleprecisioninteger

A Result

If the length of each instance of string is the same then the

An instance of singleprecisioninteger

result is the conjunction of the pairwise application of equal

to the elements of the arguments If not the result is

A Result

Returns a newly allo cated string containing the characters

of string starting at start up to end

A copy method

A Sp ecialized Arguments

A stringappend function

string string A string

A Arguments

string string Two instances of string

A Result

1 2

Constructs and returns an instance of string whose char

acters are the same as the source and such that the resulting

A Result

string is the same under equal as the source

Returns a newly allo cated string containing the characters

of string followed by the characters of string

1 2

A length method

A genericprin method

A Sp ecialized Arguments

A Sp ecialized Arguments

string string An instance of string

string string String to b e ouptut on stream

A Result

stream stream Stream on which string is to b e oup

Returns the numb er of characters in string

tut

Programming Language EuLisp version

A Result A Symb ols

The string string

The dened name of this mo dule is symbol

Output external representation of string on stream as de

scrib ed in the intro duction to this section interpreting each

of the characters in the string The op ening and closing quo

A symbol syntax

tation marks are not output

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

ers Identiers in EULISP are very similar lexically to iden

A genericwrite method

tiers in other Lisps and in other programming languages

Informally an identier is a sequence of alphabetic digit and

other characters starting with a character that is not a digit

A Sp ecialized Arguments

Characters which are special see section A must b e es

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

string string String to b e ouptut on stream

However b ecause the common notations for arithmetic op er

ations are the glyphs for plus and minus have another

stream stream Stream on which string is to b e oup

use to indicate the sign of a numb er these glyphs are classi

tut

ed as identiers in their own right as well as b eing part of

the syntax of a numb er

A Result

Sometimes it might b e desirable to incorp orate characters

The string string

in an identier that are normally not legal constituents The

aim of escaping in identiers is to change the meaning of

Output external representation of string on stream as de

particular characters so that they can app ear where they are

scrib ed in the intro duction to this section replacing single

otherwise illegal Identiers containing characters that are

characters with escap e sequences if necessary Op ening and

not ordinarily legal constituents can b e written by delimiting

closing quotation marks are output

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 multipleescapes For example

is the identier whose name contains the three characters

and and ab 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 multipleescapes

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

notes a symbol Because there are two escaping mechanisms

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

pretation of the remainder there are many ways in which to

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

the results of pro cessing each token denoting the identier

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

all denote the same symb ol

which will b e output by 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 symb ols For example ab and abcdef are two sym

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

two symb 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 symb ol a followed by the start of a list the

symb ol b and the symb ol abcdef

The syntax of the external representation of identiers and

Programming Language EuLisp version

Table A IdentierSymb ol Syntax

symbol identier

identier normalidentier j peculiaridentier

normalidentier nondigit constituent

peculiaridentier signidentier j pointidentier

signidentier fsign j sign fnondigit j sign j pointgg constituent

pointidentier point fnondigit j sign j pointg constituent

constituent nondigit j digit j sign j point

alphanumeric alphabetic j digit

nondigit alphabetic j other j escaped

escaped singleescaped j multipleescaped

multipleescaped multipleescape fsingleescaped j nonescapeg multipleescape

singleescaped singleescape fanycharacterg

nonescape notsingleescape multipleescape

multipleescape

singleescape

point

A Result symb ols is dened in Table A

Returns a string which is equal to that given as the argument

to the call to makesymbol which created symbol

A symbol class

A symbolexistsp function

The class of all instances of symbol

A Arguments

A Initoptions

string A string containing the characters to b e used to

string string The string containing the characters to b e

determine the existence of a symb ol with that name

used to name the symb ol

A Result

A symbolp function

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

already b een constructed by makesymbol Otherwise re

turns

A Arguments

obj Ob ject to examine

A genericprin method

A Result

A genericwrite method

Returns obj if obj is an instance of a sub class of symbol

A Sp ecialized Arguments

A gensym function

symbol symbol The symb ol to b e output on stream

A Arguments

stream stream The stream on which the represen

tation is to b e output

string A string contain characters to b e prep ended to

the name of the new symb ol

A Result

The symb ol supplied as the rst argument

A Result

Makes a new symb ol with a name generated by a pro cessor

dened mechanism Optionally a prex string for this name

A Remarks

may b e sp ecied

Outputs the external representation of symbol on stream as

describ ed in the intro duction to this section interpreting

each of the characters in the name

A symbolname function

A genericwrite method

A Arguments

symbol An instance of symbol

A Sp ecialized Arguments

Programming Language EuLisp version

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

stream stream The stream on which the represen

The dened name of this mo dule is table Tables provide a

tation is to b e output

general key to value asso ciation mechanism

A Result

A table class

The symb ol supplied as the rst argument

The class of all instances of table

A Remarks

Outputs the external representation of symbol on stream as

A Initoptions

describ ed in the intro duction to this section If any charac

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

comparator function The function to b e used to com

an identier or symb ol the output is preceded and succeeded

pare keys

by multipleescap e characters

A tablep function

A Arguments

obj Ob ject to examine

A Result

Returns obj is obj is an instance of table

A tableref function

A Arguments

table An instance of table

key An ob ject to b e used to identify an entry in the

table

noentryvalue An ob ject to b e returned in the case

that key is not found

A Result

If key is in table matched by the comparator function then

the asso ciated value is returned If key is not in table the

value is returned However if the optional parameter

noentryvalue is provided and key is not in table the value

noentryvalue is returned

A setter tableref setter

A Arguments

table An instance of table

key An ob ject to b e used to identify an entry new or

existing in the table

value An ob ject to b e asso ciated with key in table

A Result

If key do es not o ccur in table a new entry is made asso ciating

key and value If key do es o ccur then the asso ciation is

changed to value valueobj is returned

Programming Language EuLisp version

Table A Vector Syntax

A tabledelete function

vector extension vectorbegin obj vectorend

extension

vectorbegin

A Arguments

vectorend

table An instance of table

key An ob ject to b e used to identify an entry new or

A Vectors

existing in the table

The dened name of this mo dule is vector

A Result

If key o ccurs in table b oth the key and its asso ciated value

A vector syntax

are deleted from the table If key do es not o ccur in table no

action is taken

A vector is written as obj obj For example

1 n

is a vector of three elements the integers

A genericprin method

and The representations of obj are determined by the

i

external representations dened in other sections of this

denition see characterA doublefloatA

A genericwrite method

nullA pairA spintA stringA

and symbolA as well as instances of vector itself

The syntax for the external representation of vectors is de

A Arguments

ned in Table A

table The table to b e output on stream

A vector class

stream The stream on which the representation is to b e

output

The class of all instances of vector

A Result

The table supplied as the rst argument

A Initoptions

size spint The numb er of elements in the vector Vec

A Remarks

tors are zerobased and thus the maximum index is size

Output the external representation of table on stream

If not supplied the size is zero

The external representation of instances of table is

implementationde ned

fill object An ob ject with which to initial ize the string

If not supplied the ll ob ject is

A vectorp function

A Arguments

obj Ob ject to examine

A Result

Returns obj if obj is an instance of vector

A length method

A Arguments

vector A vector

A Result

Returns the length of vector which is the maximum index

plus one

Programming Language EuLisp version

A Result

A vectorref function

If the maximum index of each instance of vector is the same

under then the result is the conjunction of the pairwise

application of equal to the elements of the arguments If

not the result is

A setter vectorref setter

A Arguments

A copy method

vector A vector

A Arguments

n An integer to sp ecify the index of an element in the

vector

vector A vector

obj An ob ject to b e stored as element n of vector

A Result

Constructs and returns an instance of vector whose ele

A Result

ments are the same as those of the source under eql so

The accessor returns and the up dator changes the contents

that the resulting vector is the same under equal as the

of the nth index of vector The value stored in index p osition

source

n is obj which is returned

A genericprin method

A makeinitializedvector function

A genericwrite method

A Arguments

obj obj obj A sequence of ob jects

A Arguments

1 2 n

vector the vector to b e ouptut on stream

A Result

stream the stream on which the representation is to b e

Allo cate a vector of size n and store obj in vectorref

1

output

v obj in p osition vectorref v up to obj in

2 n

vectorref v n Returns the initialized vector

A Result

The vector supplied as the rst argument

A maximumvectorindex integer

A Remarks

A Remarks

Output the external representation of pair on stream as de

This is an implementationde ned constant A conforming

scrib ed in the intro duction to this section Both metho ds

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

call the generic function again to pro duce the external rep

resentation of the elements stored in the vector

A converter pair method

A Arguments

vector A vector

A Result

Constructs and returns a prop er list the elements of which

corresp ond to the elements stored in the instance of vector

A equal method

A Arguments

vector an instance of vector

1

vector an instance of vector

2

Programming Language EuLisp version

Annex B

normative

Programming Language EuLisp Level

B Classes and Ob jects sharedslotdescription for slots whose values are

shared by all the instances of the class New slot descrip

tion classes can b e dened and used here This option can

B defclass dening form

only b e sp ecied once for a particular slot Within a class

dierent slots can have dierent slot description classes

B Syntax

identier expression The symb ol named by identier

defclass classname superclass slotdescription

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

classoption

description class along with other slot options The values

are evaluated in the lexical and dynamic environment of

the defclass For the language dened slot description

B Arguments

classes no slot initargs are dened which are not sp ecied

by particular defclass slot options

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

with the new class

The additional classoption s are

superclass A list of symb ols naming bindings of

metaclass class The value of this option is the class of

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

the new class By default this is class This option

This is dierent from defcalss at level where only one

must only b e sp ecied once for the new class

sup erclass may b e sp ecied

identier expression The symb ol named by identier

slotdescription A list of slot sp ecications see b e

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

low comprising either a slotname or a list of a slotname

of the new class This list is app ended to the end of the

followed by some slotoptions An additional class option

list that defclass constructs The values are evaluated

at level allows for the sp ecication of the class of the slot

in the lexical and dynamic environment of the defclass

description

This option is used for metaclasses which need extra in

formation not provided by the standard options

classoption A sequence of keys and values see b elow

An additional class options at level allows for the sp eci

cation of the metaclass of the class

B Remarks

This dening form denes a new class The resulting class

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

The third argument is a list of slotdescriptions The remain

ing arguments are class options The syntax of defclass is

given in Table B

Table B defclass syntax level

classname identier

superclass fclass or one of its subclassesg

slotdescription slotname j

slotname slotoption

slotname identier

slotoption slotclass slotdescriptionclass j

identier expression

levelslotoption

classoption metaclass classname j

identier expression

levelclassoption

The additional slotoption s are

slotclass class The corresp onding value is a sub

class of slotdescription An implementation

conforming at level provides the slot description

class localslotdescription for slots particu

lar to instances Extension mo dules can dene

Programming Language EuLisp version

B Generic Functions defgeneric gf arg arg classa

class anothergfclass

B defgeneric dening form

classkeya classvaluea

classkeyb classvalueb

B Syntax

method methodclass anothermethodclassa

defgeneric gfname genlambdalist levelinitoption

methodclassakeya methodclassavaluea

marg classb marg classc

B Arguments

method methodclass anothermethodclassb

methodclassbkeya methodclassbvaluea

marg classd marg classe

gfname As level See section

method methodclass anothermethodclassc

lambdalist As level See section

methodclassckeya methodclasscvaluea

marg classf marg classg

initoption Format as level but with additional op

tions which are dened b elow

B Remarks

B defmethod macro

This dening form denes a new generic function The re

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

B Syntax

ond argument is the formal parameter list An error is sig

defmethod methodinitoption gfname speclambdalist

naled condition noncongruentlambdalists if any of

form

the metho ds dened on this generic function do not have

or

lamb da lists congruent to that of the generic function This

defmethod methodinitoption setter identier spec

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

lambdalist form

generic function and to any metho ds added subsequently by

or

defmethod or addmethod An initoption is a identier fol

defmethod methodinitoption converter identier

lowed by its initial value The syntax of defgeneric is an

speclambdalist form

extension of the level syntaxsee Table B

The additional initoption s are interpreted as follows

B Remarks

The syntax of defmethod is extended to accept initoptions

class gfclass The class of the new generic function

for the metho dclass of the generic function to which the

This must b e a sub class of genericfunction The de

metho d is to b e attached Otherwise the b ehaviour is as

fault is genericfunction

that dened in level

methodclass methodclass The class of all metho ds to

b e dened on this generic function All metho ds of a

B genericlambda macro

generic function must b e instances of this class or of one

of its sub classes The metho d class must b e a sub class of

method and is by default method

B Syntax

genericlambda lambdalist levelinitoption

identier expression The symb ol named by identier

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

stance of the new generic function and each new metho d

B Remarks

The values are evaluated in the lexical and dynamic envi

ronment of the defgeneric This option is used for classes

genericlambda creates and returns an anonymous generic

function that can b e applied immediately much like the nor which need extra information not provided by the stan

dard options

mal lambda The rst argument is a lamb da list while

the initoption s are interpreted exactly as for the level

denition of defgeneric An error is signaled condition

noapplicablemethod if an attempt is made to apply a

B Examples

generic function which has no applicabl e metho ds for the

In the following example of the use of defgeneric a generic

classes of the arguments supplied

function named gf is dened The dierences b etween this

function and gf see are

B Examples

a The class of the generic function is sp ecied

In the following example an anonymous version of gf see

anothergfclass along with some initoptions re

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

lated to the creation of an instance of that class

sulting ob ject is the same as gf

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

genericlambda arg arg classa

generic function is sp ecied anothermethodclass

along with an initoption related to the creation of an in

class anothergfclass

stance of that class

classkeya classvaluea

Programming Language EuLisp version

Table B defgeneric syntax level

levelinitoption levelinitoption j

class gfclass j

methodclass methodclass j

method levelmethoddescription j

gfinitoption

gfclass a subclass of genericfunction

methodclass a subclass of method

levelmethoddescription methodinitoption speclambdalist form

gfinitoption identier expression

methodinitoption identier expression

classkeyb classvalueb

method marg classd marg classe

method methodclass anothermethodclassa

methodclassakeya methodclassavaluea

marg classb marg classc

method methodclass anothermethodclassb

methodclassbkeya methodclassbvaluea

marg classd marg classe

method methodclass anothermethodclassc

methodclassckeya methodclasscvaluea

marg classf marg classg

B See also defgeneric

B genericlabels macro

B Syntax

genericlabels lambdalist levelinitoption form

B Remarks

This form is analogous to the normal labels The rst ar

gument is a binding list of the same form as that sp ecied

for the level denition of defgeneric The lexical environ

ment of each dened generic function includes the others

just like labels

B Examples

In the following example two generic functions gfa and

gfb are dened In addition the same initoptions

namely class and methodclass can b e sp ecied

genericlabels

gfa arg arg classa

method methodclass anothermethodclassa

methodclassakeya methodclassavaluea

marg classb marg classc

method methodclass anothermethodclassb

methodclassbkeya methodclassbvaluea

marg classd marg classe

method methodclass anothermethodclassc

methodclassckeya methodclasscvaluea

marg classf marg classg

gfb arg classb arg classc

method marg classb marg classc

Programming Language EuLisp version

Table B Slot Description Metaob ject Classes

B Reection on Ob jects

object abstractclass

The only reective capability of any ob ject is the access to

class metaclass

its class that is introsp ection

metaclass metaclass

abstractclass metaclass

slotdescription class

B classof function

B Reection on Classes and Slot Descriptions

B Arguments

Standard classes are not redenable and supp ort single in

object An ob ject

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

The class of the ob ject

facilities can b e provided by extensions The distinction

b etween metaclasses and nonmetaclasses is made explicit

by a sp ecial class named metaclass which is the class

B Remarks

of all metaclasses This is dierent from Ob jVlisp where

classof is a total function capable of taking any entity in

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

the system and returning an ob ject representing the class of

of the class in question It is implementationde ned whether

that entity The comp osition of this function with itself is a

metaclass itself is sp ecializab le or not This implies that

function that returns the metaclass of an ob ject classof

implementations are free to restrict the instantiation tree

is a reective op eration

excluding the selnstantiati on lo op of metaclass to a

depth of three levels

B Examples

The minimal information asso ciated with a class metaob ject

In the following examples we explore the class hierarchy

is

starting from the single precision integer

a The name which has no semantic eect

classof

singleprecisioninteger

b The class precedence list ordered most sp ecic rst

classof classof

b eginning with the class itself

class

classof classof classof

c The list of eective slot descriptions

metaclass

classof classof classof classof

d The list of eective initargs

metaclass

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

provided by extensions The minimal information asso ciated

with a slot description metaob ject is

a The name which is required to p erform inheritance

computations

b The initfunction called by default to compute the

initial slot value when creating a new instance

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

ing slot value of an instance

d The writer which is a function to write the corre

sp onding slot of an instance

The metaob ject classes dened for slot descriptions at level

are shown in Table B

B slotdescription class

The abstract class of all slot descriptions

B localslotdescription class

The class of all lo cal slot descriptions

Programming Language EuLisp version

B Initoptions

B classinitargs function

name string The name of the slot useful for debugging

only

B Arguments

reader function The function to access the slot

class A class

writer function The function to up date the slot

B Result

initfunction function The function to compute the

A list of symb ols corresp onding to the slot names sp ecied

initial value in the absence of supplied value

when the class was dened and any additional keywords for

slotoptions or classoptions

B classname function

B Remarks

The initargs contain the legal keywords which can b e used

B Arguments

to initiali ze instances of the class

class A class

B slotdescriptionname function

B Result

B Arguments

The symb ol which was given as the rst argument to

defstruct or defclass when the class was dened

slotdescription A slot description

B Remarks

B Result

The class name has no signicance other than for debugging

The symb ol which was used to name the slot when the class

of which the slotdescription is part was dened

B classprecedencelist function

B Remarks

The slot description name is used to identify a slot descrip

B Arguments

tion in a class It has no eect on bindings

class A class

B slotdescriptioninitfunction function

B Result

B Arguments

A list of classes which are the sup erclasses of class in order

of increasing generality

slotdescription A slot description

B Remarks

B Result

The class precedence list controls the inheritance of slots and

A function

metho ds

B slotdescriptionslotreader function

B classslotdescriptions function

B Arguments

B Arguments

slotdescription A slot description

class A class

B Result

A function

B Result

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

instance of class

B slotdescriptionslotwriter function

B Remarks

B Arguments

The slotdescriptions determine the instance size numb er of

slotdescription A slot description

slots and the slot access

Programming Language EuLisp version

B Result initargs

A function

slot descriptions

B Dening Metaclasses c Compute new slot accessors and ensure all new and

inherited accessors to work correctly on instances of the

new class

B defmetaclass dening form

d Make the results accessible by class readers

B Syntax

The basic call structure is laid out in Figure B

defmetaclass classname superclass slotdescription

classoption

B Initializing Slot Descriptions

B Arguments

B initialize method

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

with the new class

B Sp ecialized Arguments

superclass A symb ol naming a binding of a class to b e

slotdescription slotdescription A slot descrip

used as the sup erclass of the new class

tion

slotdescription A list of slot sp ecications see b e

low

initlist list A list of initiali zati on options as fol

lows

classoption A sequence of symb ols see b elow

name symbol The name of the slot

B Remarks

initfunction function A function

This dening form denes a new metaclass The resulting

metaclass will b e b ound to classname The second argu

ment is a sup erclass A valid classoption is predicate

B Result

The initialize d slot description

B Initializing Classes

B Inheritance Proto col

B initialize method

B compatiblesuperclassesp generic function

B Sp ecialized Arguments

B Generic Arguments

class class A class

class class Class b eing dened

initlist list A list of initiali zati on options as fol

lows

directsuperclasses list List of p otential direct su

p erclasses

name symbol Name of the class b eing initializ ed

directsuperclasses list List of direct sup erclasses

B Result

directslotdescriptions list List of slot sp ecica

True or false

tions

directinitargs list List of direct initargs

B Remarks

Checks compatibili ty b etween class and the list of direct su

p erclasses

B Result

The initialize d class

B compatiblesuperclassesp method

B Remarks

The initializa tion of a class takes place as follows

B Sp ecialized Arguments

a Check compatibility of direct sup erclasses

class class Class b eing dened

b Perform the logical inheritance computations of

directsuperclasses list List of p otential direct su

p erclasses

class precedence list

Programming Language EuLisp version

Figure B Initialization Call Structure

COMPATIBLESUPERCLASSESP cl directsuperclasses boolean

COMPATIBLESUPERCLASSP cl superclass boolean

COMPUTECLASSPRECEDENCELIST cl directsuperclasses listclass

COMPUTEINHERITEDINITARGS cl directsuperclasses listlistinitarg

COMPUTEINITARGS cl directinitargs inheritedinitargs listinitarg

COMPUTEINHERITEDSLOTDESCRIPTIONS cl directsuperclasses listlistslotd

COMPUTESLOTDESCRIPTIONS cl directslotds inheritedslotds listslotd

either

COMPUTEDEFINEDSLOTDESCRIPTION cl slotdinitlist slotd

COMPUTEDEFINEDSLOTDESCRIPTIONCLASS cl slotdinitlist slotdclass

or

COMPUTESPECIALIZEDSLOTDESCRIPTION cl inheritedslotds slotdinitlist slotd

COMPUTESPECIALIZEDSLOTDESCRIPTIONCLASS cl inheritedslotds slotdinitlist slotdclass

COMPUTEANDENSURESLOTACCESSORS cl effectiveslotds inheritedslotds listslotd

COMPUTESLOTREADER cl slotd effectiveslotds function

COMPUTESLOTWRITER cl slotd effectiveslotds function

ENSURESLOTREADER cl slotd effectiveslotds reader function

COMPUTEPRIMITIVEREADERUSINGSLOTDESCRIPTION slotd cl effectiveslotds function

COMPUTEPRIMITIVEREADERUSINGCLASS cl slotd effectiveslotds function

ENSURESLOTWRITER cl slotd writer function

COMPUTEPRIMITIVEWRITERUSINGSLOTDESCRIPTION slotd cl effectiveslotds function

COMPUTEPRIMITIVEWRITERUSINGCLASS cl slotd effectiveslotds function

B Result B Remarks

True or false This metho d returns true if the class of the rst argument

is a sub class of the class of the second argument false oth

erwise

B Remarks

The default metho d calls compatiblesuperclassp on class

and the rst element of the directsuperclasses single inher

B compatiblesuperclassp method

itance assumption

B Sp ecialized Arguments

B compatiblesuperclassp generic function

subclass class Class b eing dened

superclass abstractclass Potential direct sup er

B Generic Arguments

class

subclass class Class b eing dened

B Result

superclass class Potential direct sup erclass

True

B Result

B Remarks

True or false

This metho d always returns true

B Remarks

Checks compatibili ty b etween a sub class b eing dened rst

B compatiblesuperclassp method

argument and a p otential sup erclass second argument

B Sp ecialized Arguments

B compatiblesuperclassp method

subclass abstractclass Class b eing dened

superclass class Potential direct sup erclass

B Sp ecialized Arguments

subclass class Class b eing dened

B Result

False

superclass class Potential direct sup erclass

B Remarks

B Result

True or false This metho d always returns false

Programming Language EuLisp version

B computeclassprecedencelist generic function B computeslotdescriptions method

B Generic Arguments B Sp ecialized Arguments

class class Class b eing dened

class class Class b eing dened

directsuperclasses list List of direct sup erclasses

slotspecs list List of direct slot sp ecications

inheritedslotdescriptionlists list A list of lists

B Result

in fact one list of inherited slot descriptions

List of classes

B Result

B Remarks

List of eective slot descriptions

Computes and returns a list of classes which represents the

linearized inheritance hierarchy of class and the given list

B Remarks

of direct sup erclasses b eginning with class and ending with

object

The default metho d computes two sublists

a Sp ecialized slot descriptions by calling

computespecializedslotdescription on class each

B computeclassprecedencelist method

inheritedslotdescription wrapp ed by a list and the corre

sp onding same name slotspecication if there exits one

B Sp ecialized Arguments

or otherwise

class class Class b eing dened

b New slot descriptions by

calling computedefinedslotdescription on class and

directsuperclasses list List of direct sup erclasses

each slotspecication which has no corresp onding same

name inheritedslotdescription

B Result

The metho d returns the concatenation of these two lists as

its result The order of elements in the list is signicant

List of classes

All sp ecialized slot descriptions have the same p osition as

in the eective slot descriptions list of the direct sup erclass

B Remarks

due to the single inheritance The slot accessors computed

later may rely on this assumption minimizing the numb er of

This metho d can b e considered to return a cons of its rst

metho ds to one for all sub classes and minimizing the access

argument and the class precedence list of the rst element

time to an indexed reference

of list single inheritance assumption

B

B computeslotdescriptions generic function

See also computespecializedslotdescription

computedefinedslotdescription

computeandensureslotaccessors

B Generic Arguments

class class Class b eing dened

B computeinitargs generic function

directslotdescriptions list A list of direct slot de

scriptions

B Generic Arguments

inheritedslotdescriptions list A list of lists of in

class class Class b eing dened

herited slot descriptions

initargs list List of direct initargs

B Result

inheritedinitarglists list A list of lists of inher

List of eective slot descriptions

ited initargs

B Remarks

B Result

Computes and returns the list of eective slot descriptions

List of symb ols

of class

B Remarks

B

See also computeinheritedslotdescriptions Computes and returns all legal initargs for class

Programming Language EuLisp version

B See also computeinheritedinitargs

B computeinheritedinitargs generic function

B computeinitargs method

B Generic Arguments

class class Class b eing dened

B Sp ecialized Arguments

directsuperclasses list List of direct sup erclasses

class class Class b eing dened

initargs list List of direct initargs

B Result

inheritedinitarglists list A list of lists of inher

List of lists of symb ols

ited initargs

B Remarks

B Result

Computes and returns a list of initarglists Its result is used

List of symb ols

by computeinitargs as an argument value

B Remarks

B See also computeinitargs

This metho d app ends the second argument with the rst ele

ment of the third argument single inheritance assumption

removes duplicates and returns the result

B computeinheritedinitargs method

B Sp ecialized Arguments

B computeinheritedslotdescriptions

generic function

class class Class b eing dened

directsuperclasses list List of direct sup erclasses

B Generic Arguments

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 eective slot description lists

B computedefinedslotdescription

generic function

B See also computeslotdescriptions

B Generic Arguments

B computeinheritedslotdescriptions method

class class Class b eing dened

B Sp ecialized Arguments

slotspec list Canonicalized slot sp ecication

class class Class b eing dened

B Result

directsuperclasses list List of direct sup erclasses

Slot description

B Result

B Remarks

List of lists of inherited slot descriptions

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

The result of the default metho d is a list of one element a list

of eective slot descriptions of the rst element of the second

argument single inheritance assumption Its result is used B

by computeslotdescriptions as an argument value See also computedefinedslotdescriptionclass

Programming Language EuLisp version

B computedefinedslotdescription method B computespecializedslotdescription

generic function

B Sp ecialized Arguments

B Generic Arguments

class class Class b eing dened

class class Class b eing dened

slotspec list Canonicalized slot sp ecication

inheritedslotdescriptions list List of inherited

slot descriptions

B Result

slotspec list Canonicalized slot sp ecication or

Slot description

B Remarks

B Result

Computes and returns a new ef

Slot description

fective slot description Its class 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

class class Class b eing dened

B computespecializedslotdescription 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

slotspec list Canonicalized slot sp ecication or

Determines and returns the slot description class corresp ond

ing to class and list

B Result

B See also computedefinedslotdescription

Slot description

B computedefinedslotdescriptionclass

B Remarks

method

Computes and returns a new ef

fective slot description Its class is determined by calling

computespecializedslotdescriptionclass

B Sp ecialized Arguments

class class Class b eing dened

B

See also computespecializedslotdescriptionclass

slotspec list Canonicalized slot sp ecication

B computespecializedslotdescriptionclass

B Result

generic function

The class slotdescription

B Generic Arguments

B Remarks

class class Class b eing dened This metho d just returns the class slotdescription

Programming Language EuLisp version

inheritedslotdescriptions list List of inherited A new metho d might b e necessary if the sub classes have a

slot descriptions dierent instance allo cation or if the slot p ositions cannot

b e kept the same as in the sup erclass in multiple inheri

slotspec list Canonicalized slot sp ecication or tance extensions This can b e done during the initializa tion

computations

B Result

B computeandensureslotaccessors

Slot description class

generic function

B Remarks

B Generic Arguments

Determines and returns the slot description class corresp ond

class class Class b eing dened

ing to i the class b eing dened ii the inherited slot de

scriptions b eing sp ecialized iii the sp ecializi ng information

slotdescriptions list List of eective slot descrip

in slotspec

tions

inheritedslotdescriptions list List of inherited

B

slot descriptions

See also computespecializedslotdescription

B Result

B computespecializedslotdescriptionclass

List of eective slot descriptions

method

B Remarks

B Sp ecialized Arguments

Computes new accessors or ensures that inherited accessors

class class Class b eing dened

work correctly for each eective slot description

inheritedslotdescriptions list List of inherited

slot descriptions

B computeandensureslotaccessors method

slotspec list Canonicalized slot sp ecication or

B Sp ecialized Arguments

class class Class b eing dened

B Result

The class slotdescription

slotdescriptions list List of eective slot descrip

tions

B Remarks

inheritedslotdescriptions list List of inherited

slot descriptions

This metho d just returns the class slotdescription

B Result

B Slot Access Proto col

List of eective slot descriptions

The slot access proto col is dened via accessors readers and

writers only There is no primitive like CLOSs slotvalue

B Remarks

The accessors are generic for standard classes since they

have to work on sub classes and should do the applicabil i ty

The default metho d checks if it is a new slot description not

check anyway The key idea is that the discriminati on on

an inherited one If yes

slotdescriptions and classes is p erformed once at class de

nition time rather than again and again at slot access time

a calls computeslotreader to compute a new slot

reader and stores the result

Each slotdescription has exactly one reader and one writer

as anonymous ob jects If a readerwriter slotoption is sp eci

b calls computeslotwriter to compute a new slot

ed in a class denition the anonymous readerwriter of that

writer and stores the result

slotdescription is b ound to the sp ecied identier Thus if

a readerwriter option is sp ecied more than once the same

If not assumes that the inherited values remain valid Last

ob ject is b ound to all the identiers If the accessor slot

it ensures the reader and writer to work correctly calling

option is sp ecied the anonymous writer will b e installed as

ensureslotreader and ensureslotwriter

the setter of the reader Sp ecialized slotdescriptions refer

to the same ob jects as those in the sup erclasses single in

heritance makes that p ossible Since the readerswriters are

B computeslotreader generic function

generic it is p ossible for a sub class at the metalevel to add

new metho ds for inherited slotdescription s in order to make

B Generic Arguments the readerswriters applicabl e on instances of the sub class

Programming Language EuLisp version

class class Class

B computeslotwriter method

slotdescription slotdescription Slot

description

B Sp ecialized Arguments

slotdescriptions list List of eective slot descrip

tions 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

B Result

stances of class returning the slot value corresp onding to

Generic function

slotdescription The third argument can b e used in order to

compute the logical slot p osition

B Remarks

The default metho d returns a new generic function of two

B computeslotreader method

arguments without any metho ds Its domain is the pro duct

of class and object

B Sp ecialized Arguments

B ensureslotreader generic function

class class Class

slotdescription slotdescription Slot

B Generic Arguments

description

class class Class

slotdescriptions list List of eective slot descrip

tions

slotdescription slotdescription Slot

description

B Result

slotdescriptions list List of eective slot descrip

Generic function

tions

reader function The slot reader

B Remarks

The default metho d returns a new generic function of one

argument without any metho ds Its domain is class

B Result

Function

B computeslotwriter generic function

B Remarks

Ensures function works correctly on instances of class

B Generic Arguments

class class Class

B ensureslotreader method

slotdescription slotdescription Slot

description

B Sp ecialized Arguments

slotdescriptions list List of eective slot descrip

class class Class

tions

slotdescription slotdescription Slot

description

B Result

Function

slotdescriptions list List of eective slot descrip

tions

B Remarks

reader genericfunction The slot reader

Computes and returns a new slot writer applicable to in

stances of class and any value to b e stored as the new slot

B Result

value corresp onding to slotdescription The third argument

can b e used in order to compute the logical slot p osition Generic function

Programming Language EuLisp version

B Remarks computeprimitivewriterusingslotdescription

is called by the metho d function to compute the primitive

The default metho d checks if there is a metho d in the

writer

genericfunction If not it creates and adds a new one The

new metho d has

domain class

B computeprimitivereaderusingslotdescription

generic function

methodfufunction nctionlambda object class

primitivereader object

B Generic Arguments

computeprimitivereaderusingslotdescription

is called by the metho d function to compute the primitive

slotdescription slotdescription Slot

reader

description

class class Class

B ensureslotwriter generic function

slotdescriptions list List of eective slot descrip

tions

B Generic Arguments

class class Class

B Result

Function

slotdescription slotdescription Slot

description

B Remarks

slotdescriptions list List of eective slot descrip

tions

Computes and returns a function which returns a slot value

when applied on an instance of class

writer function The slot writer

B computeprimitivereaderusingslotdescription

B Result

method

Function

B Sp ecialized Arguments

B Remarks

Ensures function to work correctly on instances of class

slotdescription slotdescription Slot

description

B ensureslotwriter method

class class Class

slotdescriptions list List of eective slot descrip

B Sp ecialized Arguments

tions

class class Class

B Result

slotdescription slotdescription Slot

description

Function

slotdescriptions list List of eective slot descrip

tions

B Remarks

Calls computeprimitivereaderusingclass This is the

writer genericfunction The slot writer

default metho d

B Result

B computeprimitivereaderusingclass

Generic function

generic function

B Remarks

B Generic Arguments

The default metho d checks if there is a metho d in the

genericfunction If not creates and adds a new one The

class class Class

new metho d has

slotdescription slotdescription Slot

domain class object

description

methodfufunction nctionlambda obj class

slotdescriptions list List of eective slot descrip

newvalue object

tions

primitivewriter obj newvalue

Programming Language EuLisp version

B Result B Result

Function

Function

B Remarks

B Remarks

Computes and returns a function which returns the slot value

Calls computeprimitivewriterusingclass This is the

when applied on an instance of class

default metho d

B computeprimitivewriterusingclass

B computeprimitivereaderusingclass method

generic function

B Sp ecialized Arguments

B Generic Arguments

class class Class

class class Class

slotdescription slotdescription Slot

description slotdescription slotdescription Slot

description

slotdescriptions list List of eective slot descrip

tions

slotdescriptions list List of eective slot descrip

tions

B Result

B Result

Function

Function

B Remarks

B Remarks

The default metho d returns a function of one argument

Computes and returns a function which stores the new slot

value when applied on an instance of class and new value

B computeprimitivewriterusingslotdescription

generic function

B computeprimitivereaderusingclass method

B Generic Arguments

B Sp ecialized Arguments

slotdescription slotdescription Slot

description

class class Class

class class Class

slotdescription slotdescription Slot

description

slotdescriptions list List of eective slot descrip

tions

slotdescriptions list List of eective slot descrip

tions

B Result

Function

B Result

Function

B Remarks

Computes and returns a function which stores a new slot

B Remarks

value when applied on an instance of class and a new value

The default metho d returns a function of two arguments

B computeprimitivewriterusingslotdescription

B Predicates and Constructors

method

B computepredicate generic function

B Sp ecialized Arguments

B Generic Arguments

slotdescription slotdescription Slot

description

class class Class

class class Class

B Result

slotdescriptions list List of eective slot descrip

Function

tions

Programming Language EuLisp version

B Remarks class class A class

Computes and returns a predicate function of one argument

initlist list A list of initiali zati on arguments

B computepredicate method

B Result

An instance of the rst argument

B Sp ecialized Arguments

class class Class

B Remarks

Creates an instance of the rst argument Users may dene

new metho ds for new metaclasses

B Result

Function

B allocate method

B Remarks

Computes and returns a predicate function of one argument

B Sp ecialized Arguments

which returns true when applied on direct or indirect in

stances of class and false otherwise

class class A class

initlist list A list of initiali zati on arguments

B computeconstructor generic function

B Result

B Generic Arguments

An instance of the rst argument

class class Class

B Remarks

parameters list Argument list of the function b e

ing created

The default metho d creates a new uninitial i zed instance of

the rst argument The initlist is not used by this allocate

metho d

B Result

Function

B Low Level Allo cation Primitives

B Remarks

This mo dule provides primitives which are necessary to im

Computes and returns a constructor function

plement new allo cation metho ds p ortably However they

should b e dened in such a way that ob jects cannot b e de

stroyed unintentional ly In consequence it is an error to use

primitiveclassof primitiveref and their setters on

B computeconstructor method

ob jects not created by primitiveallocate

B Sp ecialized Arguments

B primitiveallocate function

class class Class

parameters list Argument list of the function b e

B Arguments

ing created

class A class

B Result

size An integer

Function

B Result

B Remarks

An instance of the rst argument

Computes and returns a constructor function which returns

a new instance of class when applied

B Remarks

B Instance Allo cation

This function returns a new instance of the rst argument

which has a vector like structure of length size The com

p onents of the new instance can b e accessed by means

B allocate generic function

of primitiveref and setter primitiveref It is in

tended to b e used in new allocate metho ds dened for new

B Generic Arguments metaclasses

Programming Language EuLisp version

B primitiveclassof function B setter primitiveref function

B Arguments

B Arguments

object An ob ject created by primitiveallocate

object An ob ject created by primitiveallocate

index The index of a comp onent

B Result

value The new value which can b e any ob ject

A class

B Result

The new value

B Remarks

This function returns the class of an ob ject It is similar to

classof which has a dened b ehaviour on any ob ject It is

B Remarks

an error to use primitiveclassof on ob jects which were

Stores and returns the new value as the ob jects comp onent

not created by primitiveallocate

corresp onding to the supplied index It is an error if the

index is out of range This function is intended to b e used

when dening new kinds of accessors for new metaclasses

B setter primitiveclassof setter

B Arguments

object An ob ject created by primitiveallocate

class A class

B Result

The class

B Remarks

This function supp orts p ortable implementations of

a dynamic classicatio n like changeclass in CLOS

b automatic instance up dating of redened classes

B primitiveref function

B Arguments

object An ob ject created by primitiveallocate

index The index of a comp onent

B Result

An ob ject

B Remarks

Returns the value of the ob jects comp onent corresp onding

to the supplied index It is an error if the index is out of

range This function is intended to b e used when dening

new kinds of accessors for new metaclasses

Programming Language EuLisp version

Table B Metaob ject Classes

B genericfunctionname function

Table B Generic Function Metaob ject Classes

object abstractclass

B Arguments

class metaclass

metaclass metaclass

genericfunction A generic function

abstractclass metaclass

functionclass metaclass

genericfunction functionclass

B Result

method class

A symb ol

B Remarks

B Reection on Generic Functions and

The name has only debugging purp oses

Metho ds

The generic dispatch is class based ie metho ds are class

B See also classname

sp ecic Instance sp ecic metho ds can b e provided even

p ortably in an extension mo dule by dening a new generic

function class We think it is confusing to have generic func

B genericfunctiondomain function

tions with b oth class sp ecic and instance sp ecic meth

o ds Combining dierent discriminati on strategies in a single

generic function is rather a shortcoming than an advantage

B Arguments

The argument precedence order is always lefttoright

genericfunction A generic function

The minimal information asso ciated with a generic function

metaob ject is

B Result

a The name which has no semantic eect

List of classes

b The domain restricting the domain of each added

metho d to a sub domain

B Remarks

c The range restricting the range of each added metho d

Returns the domain of a generic function All metho ds at

to a subrange

tached to a generic function have sub domains of it

d The metho d class restricting each added metho d to

b e an instance direct or indirect of that class

B genericfunctionrange function

e The list of all added metho ds

B Arguments

f The metho d lo okup function to collect and sort the

applicabl e metho ds

genericfunction A generic function

g The discriminatin g function to p erform the generic

dispatch

B Result

A class

The minimal information asso ciated with a metho d metaob

ject is

B Remarks

a The domain which is a list of classes

Returns the range of a generic function Each metho d at

tached to a generic function must have a subrange of it

b The range which is a class

c The function comprising the co de of the metho d

B genericfunctionmethodclass function

d The generic function if the metho d has b een added

to one at the most

B Arguments

genericfunction A generic function

The metaob ject classes for generic functions dened at level

are shown in Table B

B Result

B Introsp ection

A class

Programming Language EuLisp version

B Remarks B Result

Returns the metho d class of a generic function Each metho d

List of classes

attached to a generic function must b e an instance of that

class When a metho d is dened using defmethod it will b e

an instance of that class by default

B Remarks

Returns the domain of a metho d

B genericfunctionmethods function

B methodrange function

B Arguments

B Arguments

genericfunction A generic function

method A metho d

B Result

A list of metho ds

B Result

A class

B Remarks

Returns a list of metho ds attached to the generic function

B Remarks

Returns the range of a metho d

B genericfunctionmethodlookupfunction

function

B methodfunction function

B Arguments

genericfunction A generic function

B Arguments

method A metho d

B Result

A function

B Result

B Remarks

A function

Returns a function applicabl e on same arguments as the

generic function which returns a sorted list of applicabl e

B Remarks

metho ds when applied

Returns the function which is called when a metho d is called

The metho d itself can not b e applied or called as a function

B genericfunctiondiscriminatingfunction

function

B methodgenericfunction function

B Arguments

B Arguments

genericfunction A generic function

method method A metho d

B Result

A function

B Result

A generic function or false

B Remarks

Returns a function applicabl e on same arguments as the

generic function which is called everytime when the generic

B Remarks

function is called It p erforms the generic dispatch and calls

Returns the generic function to which the metho d is at

the applicable metho ds

tached false otherwise

B methoddomain function

B Sp ecial forms or macros

The followin macros hide the implementation details of call

B Arguments

ing metho ds arranging the next metho ds so that they are

accessible by callnextmethod etc

method A metho d

Programming Language EuLisp version

genericfunction genericfunction A generic func

tion

B methodfunctionlambda macro

B callmethod macro

B Result

The initiali zed metho d

B applymethod macro

B Remarks

B Initializing Generic Functions and Meth

Initializes and returns the method There is nothing sp ecial

o ds

to sp ecify for this metho d

B initialize method

B Metho d Lo okup and Generic Dispatch

B Sp ecialized Arguments

B computemethodlookupfunction

generic function

genericfunction genericfunction A generic

function

B Generic Arguments

initlist list A list of initiali zati on options as fol

lows

genericfunction genericfunction A generic

function

name symbol The name of the generic function

domain list A list of classes which span the do

domain list List of argument classes

main

range class The class of the result

B Result

methodclass class Class of attached metho d

A function

methods list List of metho ds to b e attached

B Remarks

B Result

Computes and returns a function which is called at least ones

The initializ ed generic function

for a particular domain in order to select and sort the appli

cable metho ds by the system provided dispatch mechanism

Users may dene new metho ds for it in order to implement

B Remarks

dierent metho d lo okup strategies Althought there is just

Initializes and returns the genericfunction It calls

one lo okup strategie provided by the system each generic

computemethodlookupfunction

function may have its own more ecient lo okup function

computediscriminatingfunction and stores their results

as well as the direct information passed as arguments

B computemethodlookupfunction method

The basic call structure is

COMPUTEMETHODLOOKUPFUNCTION

B Sp ecialized Arguments

genericfunction domain function

COMPUTEDISCRIMINATINGFUNCTION

genericfunction genericfunction A generic

genericfunction domain lookupfn methods function

function

domain list A list of classes which span the do

B initialize method

main

B Sp ecialized Arguments

B Result

method method A metho d

A function

initlist list A list of initiali zati on options as fol

lows

B Remarks

domain list List of argument classes Computes and returns a function which is called at least ones

for a particular domain in order to select and sort the appli

range class The class of the result cable metho ds by the system provided dispatch mechanism

It is not sp ecied whether or not each generic function gets

function function A function its own lo okup function

Programming Language EuLisp version

remove a metho d with the same domain as the metho d b e

ing added Instead removemethod must b e used explicitly

B computediscriminatingfunction

b efore adding the new one

generic function

B Generic Arguments

B addmethod generic function

genericfunction genericfunction A generic

B Generic Arguments

function

genericfunction genericfunction A generic

domain list A list of classes which span the do

function

main

method method A metho d to b e attached

lookupfunction function The metho d lo okup

function

B Result

methods list A list of metho ds attached to the

The generic function

genericfunction

B Remarks

B Result

Adds a metho d to a generic function User may dene new

A function

metho ds to it for new generic function and metho d classes

B Remarks

B addmethod method

Computes and returns a function which is called whenever

the generic function is called It is the controller of the

generic dispatch Users may dene new metho ds for new

B Sp ecialized Arguments

generic function classes in order to implement other dispatch

strategies eg eqldiscrimi nati on as in CLOS

genericfunction genericfunction A generic

function

method method A metho d to b e attached

B computediscriminatingfunction method

B Result

B Sp ecialized Arguments

The generic function

genericfunction genericfunction A generic

function

B Remarks

Checks if the domain the range as well as the class of the

domain list A list of classes which span the do

metho d are more sp ecial than those of the generic function

main

If not signals an error Checks if there is a metho d with the

same domain attached to the generic function already If

lookupfunction function The metho d lo okup

yes signals an error If no error o ccures adds the metho d to

function

the generic function Dep ending on particular optimizations

of the generic dispatch adding a metho d may cause some

methods list A list of metho ds attached to the

up dating computations

genericfunction

B removemethod generic function

B Result

A function

B Generic Arguments

B Remarks

genericfunction genericfunction A generic

Computes and returns a function which is called whenever

function

the generic function is called It is unsp ecied which opti

mizations are provided by this function

method method A metho d to b e removed

B Result

B Extending Generic Functions by New

Metho ds

The generic function

These op erations provide means to add and remove meth

B Remarks

o ds dynamicall y tofrom generic functions They are in

Removes a metho d from a generic function User may dene tended to supp ort p ortable programming environment im

new metho ds for new generic function and metho d classes plementations In contrast to CLOS addmethod do es not

Programming Language EuLisp version

B Dynamic Binding

B removemethod method

B dynamic special form

B Sp ecialized Arguments

B Syntax

genericfunction genericfunction A generic

dynamic identier

function

method method A metho d to b e removed

B Arguments

identier A symb ol naming a dynamic binding

B Result

The generic function

B Result

The value of closest dynamic binding of symbol named by

B Remarks

identier is returned If no such binding exists an error is

If the metho d is attached to the generic function it will b e

signaled condition unbounddynamicvariable

removed as well as the backp ointer from the metho d to the

generic function Dep ending on particular optimizations of

the generic dispatch removing a metho d may cause some

B dynamicsetq special form

up dating computations

B Syntax

dynamicsetq identier form

B Arguments

identier A symb ol naming a dynamic binding to b e

up dated

form An expression whose value will b e stored in the

dynamic binding of identier

B Result

The value of form

B Remarks

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

dynamic binding of symbol named by identier An error

is signaled condition unbounddynamicvariable if sym

bol is not dynamicall y apparent and has no dynamic global

value

B unbounddynamicvariable executioncondition

B Initoptions

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

B dynamiclet special form

B Syntax

dynamiclet binding form

Programming Language EuLisp version

B Arguments when antecedent form

binding A list of binding sp eciciers

B Remarks

body A sequence of forms

The when op erator evaluates antecedent and if the result is

not the forms are evaluated from left to right It is

equivalent to if with a null alternative If the evaluation of

B Result

antecedent is not the result of the when form is that of

The sequence of forms is evaluated in order returning the

the evaluation of the last form otherwise the result is

value of the last one as the result of the dynamiclet form

The rewrite rule for when is

B Remarks

when Is an error

A binding sp ecier is either an identier or a two element

when antecedent

list of an identier and an initiali zi ng form All the initial

when form form if form progn form

1 2 1 2

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 environment to

B unless macro

hold the results These bindings have dynamic scop e and

dynamic extent Each form in body is evaluated in order in

the environment extended by the ab ove bindings The result

B Syntax

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

unless antecedent form

of dynamiclet

B Remarks

B defvar dening form

The unless op erator evaluates the rst form and if the result

is the remaining forms are evaluated from left to right It

B Syntax

is equivalent to if with a null consequence If the evaluation

of the rst form is the result of the unless form is the

defvar name expression

result of the evaluation of the last form otherwise the result

is The rewrite rule for unless is

B Arguments

identier A symb ol naming a top dynamic binding con

unless Is an error

taining the value of form

unless antecedent

unless form form if form progn form

1 2 1 2

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

dynamic binding of identier

B Exit Extensions

B Remarks

B block macro

The value of form is stored as the top dynamic value

of the symb ol named by identier The binding created

by defvar is mutable An error is signaled condition

B Syntax

dynamicmultiplydefined on evaluating this form more

block identier form

than once for the same identier

B Remarks

B dynamicmultiplydefined executioncondition

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

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

B Initoptions

invoked anywhere within the blo ck by using returnfrom

The forms are evaluated in sequence and the value of the

symbol symbol A symb ol naming the dynamic variable

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

which has already b een dened

letcc The rewrite rules for block are

B Remarks

block Is an error

Signalled by defvar if the named dynamic variable already

block identier

exists

block identier form letcc identier form

Exiting from a block by whatever means causes the restora

B Conditional Extensions

tion of the lexical environment and dynamic environment

that existed b efore block entry The ab ove rewrite for block

B when macro

do es not prevent the block b eing exited from anywhere in its

dynamic extent since the blockexit function is a rstclass

B Syntax item and can b e passed as an argument like other values

Programming Language EuLisp version

B See also returnfrom B Remarks

In throw the tag names the continuation of the catch from

which to return throw is the invo cation of the continuation

B returnfrom macro

of the catch named tag The form is evaluated and the value

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

B Syntax

binding of the symb ol which is where the continuation is

returnfrom identier form

b ound The rewrite rules for throw are

throw Is an error

B Remarks

throw tag dynamic tag

In returnfrom the identier names the continuation of the

throw tag form dynamic tag form

lexical block from which to return returnfrom is the

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

B See also catch

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

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

returnfrom are

B Summary of Level Expressions and Def

returnfrom Is an error

initions

returnfrom identier identier

returnfrom identier form identier form

The syntax of all level expressions and denitions is given

in Table B Any pro ductions undened here app ear else

where in the denition sp ecically the syntax of most ex

B See also block

pressions and denitions is completed in the section dening

level

B catch macro

B Syntax

catch tag form

B Remarks

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

to create a dynamically scop ed binding of tag to the contin

uation of the catch form The continuation can b e invoked

anywhere within the dynamic extent of the catch form by

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

catch Is an error

catch tag progn tag

catch tag form letcc tmp

dynamiclet tag tmp

form

Exiting from a catch by whatever means causes the restora

tion of the lexical environment and dynamic environment

that existed b efore the catch was entered The ab ove rewrite

for catch causes the variable tmp to b e shadowed This is

an artifact of the ab ove presentation only and a conforming

pro cessor must not shadow any variables that could o ccur in

the b o dy of catch in this way

B See also throw

B throw macro

B Syntax

throw tag form

Programming Language EuLisp version

Table B Expressions and Denitions level

moduleexpression exportspec j levelexpression j levelexpression j denition j progn expression

denition leveldenition j leveldenition

fdefmoduleg

leveldenition defclass j defcondition j defgeneric j defvar j

leveldenition

defclass defclass classname superclass slotdescription classoption

classname identier

superclass fclass or one of its subclassesg

slotdescription slotname j

slotname slotoption

slotname identier

slotoption slotclass slotdescriptionclass j

identier expression

levelslotoption

classoption metaclass classname j

identier expression

levelclassoption

defgeneric defgeneric gfname genlambdalist levelinitoption

levelinitoption levelinitoption j

class gfclass j

methodclass methodclass j

method levelmethoddescription j

gfinitoption

gfclass a subclass of genericfunction

methodclass a subclass of method

levelmethoddescription methodinitoption speclambdalist form

gfinitoption identier expression

methodinitoption identier expression

defvar defvar name expression

levelexpression dynamiclet j dynref j dynassign j levelexpression

dynref dynamic identier

dynassign dynamicsetq identier form

dynamiclet dynamiclet binding form

Programming Language EuLisp version

References Padget et al Padget JA et al Desiderata for the

Standardisation of Lisp Pro ceedings of ACM

Conference on Lisp and Functional Programming

Alb erga et al Alb erga CN BosmanClark C

pp published by ACM Press New York

Mikelsons M Van Deusen M Padget JA

Experience with an Uncommon LISP Pro ceedings

Padget Padget JA A Simple Lightweight Pro

of ACM Symp osium on LISP and Functional

cess Mechanism in Lisp in preparation

Programming ACM New York also available

as IBM Research Rep ort RC

Pitman Pitman KM An Error System for Com

Bobrow et al Bobrow DG DiMichiel LG

mon Lisp ISOWG pap er N

Gabriel RP Keene SE Kiczales G Mo on DA

Common Lisp Object System Specication SIG

Rees et al Rees JA The T Manual YALEU

PLAN Notices Vol Septemb er

Technical Rep ort

Chailloux et al Chailloux J Devin M Hul

Slade Slade S The T Programming Language a

lot JM LELISP A Portable and Ecient Lisp

Dialect of Lisp PrenticeHall

System Pro ceedings of ACM Symp osium on

Lisp and Functional Programming Austin Texas

Shalit Shalit A Dylan an objectoriented dy

pp published by ACM Press New York

namic language Apple Computer Inc

Chailloux et al Chailloux J Devin M Dup ont

Steele Steele GL Jr Common Lisp the Lan

F Hullot JM Serp ette B Vuillemin J lelisp

guage Digital Press and Common Lisp the

de lINRIA Version Manuel de reference IN

Language second edition Digital Press

RIA Ro cquencourt May

Stoyan et al Stoyan H et al Towards a Lisp

Clinger Rees Clinger W Rees JA eds

Standard published in the Pro ceedings of the

3

The Revised Report on Scheme SIGPLAN Notices

Europ ean Conference on Articial Intelligence

Vol No

Teitelman Teitelman W The Interlisp Reference

Cointe Cointe P Mateclasses are First Class the

Manual Xerox Palo Alto Research Center

ObjVlisp model Pro ceedings of OOPSLA pub

lished as SIGPLAN Notices Vol No pp

Fitch Norman Fitch JP Norman AC Im

plementing Lisp in a HighLevel Language Software

Practice and Exp erience Vol pp

Friedman Haynes Friedman D Haynes C

Constraining Control Pro ceedings of th Annual

ACM Symp osium on Principles of Programming

Languages pp published by ACM Press

New York

Hudak Wadler et al Hudak P Wadler P

eds Report on the Functional Programming Lan

guage Haskel l Yale University Department of Com

puter Science Research Rep ort YALEUDCSRR

Decemb er

Landin Landin PJ The Next Programming

Languages Communications of the ACM Vol No

pp

Lang Pearlmutter Lang KJ Pearlmutter

BA Oaklisp An ObjectOriented Dialect of

Scheme Lisp and Symb olic Computation Vol

No June pp published by Kluwer

Academic Publishers Boston

MacQueen MacQueen D et al Modules for

Standard ML Pro ceedings of ACM Symp o

sium on Lisp and Functional Programming Austin

Texas pp published by ACM Press New

York

Milner et al Milner R et al Standard ML Lab

oratory for the Foundations of Computer Science

University of Edinburgh Technical Rep ort

Programming Language EuLisp version

Function Index

number primitiveallocate level

primitiveclassof level

number

primitiveref level

number

prin stream

number

read stream

number

scan formattedio

number

semaphorep semaphore

number

setter level

number

setter car pair

apply level

setter cdr pair

atom pair

setter converter convert

binarystreamp stream

setter primitiveclassof level

car pair

setter primitiveref level

cdr pair

setter stringref string

cerror condition

setter tableref table

characterp character

setter vectorref vector

characterstreamp stream

signal condition

classinitargs level

singleprecisionintegerp spint

classname level

slotdescriptioninitfunction level

classof level

slotdescriptionname level

classprecedencelist level

slotdescriptionslotreader level

classslotdescriptions level

slotdescriptionslotwriter level

closesemaphore semaphore

stringappend string

conditionmessage condition

stringlt string

conditionp condition

stringp string

cons pair

stringref string

consp pair

stringslice string

convert convert

symbolexistsp symbol

converter convert

symbolname symbol

copyalist pair

symbolp symbol

copylist pair

tabledelete table

copytree pair

tablep table

currentthread thread

tableref table

doublefloatp double

threadp thread

eq compare

threadreschedule thread

eql compare

threadstart thread

error condition

threadvalue thread

filestreamp stream

vectorp vector

floatp number

vectorref vector

format formattedio

write stream

genericfunctiondiscriminatingfunction level

genericfunctiondomain level

genericfunctionmethodclass level

genericfunctionmethodlookupfunction level

genericfunctionmethods level

genericfunctionname level

genericfunctionrange level

gensym symbol

inputstreamp stream

integerp number

iostreamp stream

list pair

make level

makeinitializedvector vector

max number

methoddomain level

methodfunction level

methodgenericfunction level

methodrange level

min number

null null

numberp number

opensemaphore semaphore

outputstreamp stream

Programming Language EuLisp version

Macro Index

and level

applymethod level

block level

callmethod level

catch level

cond level

defmethod level

defmethod level

genericlabels level

genericlambda level

let level

let level

methodfunctionlambda level

or level

quasiquote level

returnfrom level

throw level

unless level

when level

Programming Language EuLisp version

Generic Function Index

compare genericread stream

genericwrite level

abs number

genericwrite stream

acos elementaryfunctions

initialize level

acosh elementaryfunctions

lcm number

addmethod level

log elementaryfunctions

allocate level

log elementaryfunctions

asin elementaryfunctions

log elementaryfunctions

asinh elementaryfunctions

map character

atan elementaryfunctions

member character

atan elementaryfunctions

modulo spint

atanh elementaryfunctions

negate number

binarydifference number

negativep number

binarydivide number

oddp spint

binarygcd number

open stream

binarylcm number

openp stream

binarylt number

peekunit stream

binaryplus number

positivep number

binarytimes number

quotient spint

catenate character

readunit stream

ceiling double

reduce character

close stream

reduce character

compatiblesuperclassesp level

remainder spint

compatiblesuperclassp level

removemethod level

computeandensureslotaccessors level

round double

computeclassprecedencelist level

signum number

computeconstructor level

sin elementaryfunctions

computedefinedslotdescription level

sinh elementaryfunctions

computedefinedslotdescriptionclass level

size character

sqrt elementaryfunctions

computediscriminatingfunction level

tan elementaryfunctions

computeinheritedinitargs level

tanh elementaryfunctions

computeinheritedslotdescriptions level

truncate double

computeinitargs level

wait level

computemethodlookupfunction level

writeunit stream

computepredicate level

zerop number

computeprimitivereaderusingclass level

computeprimitivereaderusingslotdescription

level

computeprimitivewriterusingclass level

computeprimitivewriterusingslotdescription

level

computeslotdescriptions level

computeslotreader level

computeslotwriter level

computespecializedslotdescription level

computespecializedslotdescriptionclass

level

copy copy

cos elementaryfunctions

cosh elementaryfunctions

do character

emptyp character

ensureslotreader level

ensureslotwriter level

equal compare

evenp spint

exp elementaryfunctions

expt elementaryfunctions

fill character

filter character

floor double

flush stream

gcd number

genericprin level

genericprin stream

Programming Language EuLisp version

Metho d Index

addmethod level genericprin spint

genericprin string

allocate level

genericprin symbol

ceiling double

genericprin table

close stream

genericprin thread

compatiblesuperclassesp level

genericprin vector

compatiblesuperclassp level

genericread stream

compatiblesuperclassp level

genericwrite character

compatiblesuperclassp level

genericwrite character

computeandensureslotaccessors level

genericwrite double

computeclassprecedencelist level

genericwrite null

computeconstructor level

genericwrite pair

computedefinedslotdescription level

genericwrite semaphore

computedefinedslotdescriptionclass level

genericwrite spint

genericwrite string

computediscriminatingfunction level

genericwrite symbol

computeinheritedinitargs level

genericwrite symbol

computeinheritedslotdescriptions level

genericwrite table

computeinitargs level

genericwrite thread

computemethodlookupfunction level

genericwrite vector

computepredicate level

initialize level

computeprimitivereaderusingclass level

initialize level

computeprimitivereaderusingclass level

initialize level

computeprimitivereaderusingslotdescription

initialize level

level

initialize level

computeprimitivewriterusingslotdescription

initializeinstance condition

level

length null

computeslotdescriptions level

length pair

computeslotreader level

length string

computeslotwriter level

length vector

computespecializedslotdescription level

modulo spint

computespecializedslotdescriptionclass

oddp spint

level

open stream

converter character spint

openp stream

converter doublefloat spint

peekunit stream

converter integer character

quotient spint

converter pair string

readunit stream

converter pair vector

remainder spint

converter singleprecisioninteger double

removemethod level

converter string double

round double

converter string pair

sqrt elementaryfunctions

converter string pair

sqrt elementaryfunctions

converter string spint

truncate double

copy character

wait stream

copy copy

wait thread

copy double

writeunit stream

copy pair

writeunit stream

copy spint

copy string

copy vector

ensureslotreader level

ensureslotwriter level

equal character

equal compare

equal number

equal pair

equal string

equal vector

evenp spint

floor double

flush stream

genericprin character

genericprin double

genericprin null

genericprin pair

genericprin semaphore

Programming Language EuLisp version

Condition Index

arithmeticcondition number

badapplyargument level

cannotconverttocharacter spint

cannotupdatesetter level

conversioncondition convert

divisionbyzero spint

dynamicmultiplydefined level

environmentcondition condition

executioncondition condition

improperunquotesplice level

incompatiblemethodsignature level

integerconversionoverflow double

invalidoperator level

noapplicablemethod level

noconverter convert

noncongruentlambdalists level

nonextmethod level

nosetter level

nosuchcharacter spint

notacharacter pair

ntcharacter pair

oldthread thread

scanmismatch formattedio

streamcondition stream

syntaxerror stream

teloscondition level

threadcondition thread

unbounddynamicvariable level

wrongconditionclass condition

wrongthread thread

Programming Language EuLisp version

Constant Index

inputstream stream

iostream stream

leastnegativedoublefloat double

leastpositivedoublefloat double

maximumvectorindex vector

mostnegativedoublefloat double

mostnegativesingleprecisioninteger spint

mostpositivedoublefloat double

mostpositivesingleprecisioninteger spint

nil

ouputstream stream

pi elementaryfunctions

t

tickspersecond level

Programming Language EuLisp version

General Index

character

character

characterextension glyph

characterp

characterstreamp

Common Lisp

class

constructor

null

primitive

selfinstantiated

abs class option

accessor class precedence list

acos classinitargs

acosh classname

addmethod classof

allocate classprecedencelist

and classslotdescriptions

applicable metho d CLOS

applicable metho d list close

applicable ob ject closesemaphore

apply closure

applymethod collection

asin comment

asinh commentbegin glyph

assignment Common Lisp Error System

atan compatiblesuperclassesp

atan compatiblesuperclassp

atanh compliance

atom computeandensureslotaccessors

backquoting computeclassprecedencelist

base computeconstructor

arbitrary base literals computedefinedslotdescription

limitation on input computedefinedslotdescriptionclass

binary literals computediscriminatingfunction

binarydifference computeinheritedinitargs

binarydivide computeinheritedslotdescriptions

binarygcd computeinitargs

binarylcm computemethodlookupfunction

binarylt computepredicate

binaryplus computeprimitivereaderusingclass

binarystreamp computeprimitivereaderusingslotdescription

binarytimes computeprimitivewriterusingclass

binding computeprimitivewriterusingslotdescription

dynamically scop ed computeslotdescriptions

mo dule computeslotreader

of mo dule names computeslotwriter

top dynamic computespecializedslotdescription

binding form computespecializedslotdescriptionclass

block cond

see also letcc condition

b o olean condition

denition of continuable

b ound variable noncontinuabl e

callmethod conditionmessage

callnextmethod conditionp

Cambridge LISP conguration

car conformance

case sensitivity level

catch level

catenate level

cdr conforming pro cessor

ceiling conforming program

cerror conformity clause

character least negative double precision oat

Programming Language EuLisp version

least p ositive double precision oat dynamic scop e

maximum vector index dynamicall y closer

most negative double precision oat dynamiclet

most negative single precision integer dynamicsetq

most p ositive double precision oat elementary functions

most p ositive single precision integer empty list

congruent emptyp

cons ensureslotreader

consp ensureslotwriter

constant environmental error

dened eq

literal implementation den ed b ehaviour

constructor eql

continuation equal

conventions error

convert error

converter can b e signaled

converter character dynamic

converter doublefloat environmental

converter function handler

converter integer signaled

converter pair static

converter singleprecisioninteger level

converter string level

copy level

copyalist libraries

copylist evenp

copytree except

cos exp

cosh export

currentthread exportsyntax

defclass expose

defcondition expt

defconstant extension

defgeneric extent

dening form empty list

defclass oating p oint

defcondition integer

defconstant list

defgeneric null empty list

deflocal pair

defmacro string

defmetaclass vector

defstruct external representation see also prin and write

defun write

defvar filestream

deflocal filestreamp

defmacro fill

defmetaclass filter

defmethod float

defmodule floatp

defstruct floor

defun flush

defvar form

direct instance format

direct slot description formattedio

direct sub class free variable

direct sup erclass function

discriminatio n accessor function

do calling

double oat standard function

doublefloat up dator function

doublefloat gcd

doublefloatp generic arithmetic

dynamic generic function

dynamic environment discrimina tion

dynamic error lamb dalist

dynamic extent genericfunctiondiscriminatingfunction

Programming Language EuLisp version

genericfunctiondomain LELISP

genericfunctionmethodclass LeLisp

genericfunctionmethodlookupfunction length

genericfunctionmethods let

genericfunctionrange let

genericlabels letcc

genericlambda see also block and returnfrom

genericprin level

level classes

genericread character

genericwrite doublefloat

float

gensym integer

Haskell null

hexadecimal

pair

notation in strings semaphore

hexadecimal literals spint

identier

stream

denition of string

p eculiar identiers symbol

syntax table

if thread

implementationde ned vector

b ehaviour of eq level mo dules

b ehaviour of equal

character

oatingp oint precision collection

least negative double precision oat compare

least p ositive double precision oat

condition

maximum vector index convert

mo dule binding environment copy

most negative double precision oat

double

most negative single precision integer elementaryfunctions

most p ositive double precision oat formattedio

most p ositive single precision integer leveleuli sp

representation of tables null

time units p er second numb er

unhandled conditions pair

improp er list

semaphore

indenite extent spint

indenite scop e stream

indirect instance

string

indirect slot description symb ol

indirect sub class table

single thread

inheritance graph vector

inherited slot description lexical environment

initarg lexical scop e

initform lexicall y closer

initfunction LISPVM

initializ ation list

initialize list

initializeinstance empty

initlist literal

inner dynamic

arbitrary base

inner lexical binary

inputstreamp character

instance hexadecimal

direct mo dication of

indirect o ctal

instantiation graph quotation

integer localslotdescription

integerp log

InterLISP log

iostreamp log

labels macro

lambda denition by defmacro

lamb dalist macro expansionsee also syntax

lcm macro expression

Programming Language EuLisp version

macrossee also syntax prop er list

make function call

makeinitializedvector quasiquotati on

map quasiquote

max abbreviation with

member quotation

metaclass quote

metho d abbreviation with

applicable quotient

bindings read

list of applicable reader

lo okup readunit

sp ecicity reduce

metho d combination reduce

metho d function reective

metho d lo okup remainder

metho d sp ecicity removemethod

methoddomain rename

methodfunction returnfrom

methodfunctionlambda see also letcc

methodgenericfunction round

methodrange scan

MicroCeyx scop e

min in labels expressions

mo dule of dynamiclet bindings

environments of lambda bindings

imp orts of letcc binding

name bindings selfinstantiated class

modulo semaphore

multimetho d semaphore

negate semaphorep

negativep setq

new instance setter

nextmethodp setter car

null setter cdr

null setter converter

null setter function

number setter primitiveclassof

numberp setter primitiveref

Oaklisp setter stringref

ob ject setter tableref

Ob jVLisp setter vectorref

o ctal literals shadow

oddp signal

only signature

open signum

openp sin

opensemaphore single inheritance

or single precision integer

outputstreamp singleprecisioninteger

pair singleprecisioninteger

pair singleprecisionintegerp

pair sinh

peekunit size

positivep slot

primitiveallocate accessor

primitiveclassof reader

primitiveref writer

prin slot description

constants direct

op erand indirect

op erator slot description list

symb ols slot option

pro cessor slotdescription

representation of semaphore slotdescriptioninitfunction

representation of threads slotdescriptionname

gensym names slotdescriptionslotreader

progn slotdescriptionslotwriter

Programming Language EuLisp version

sp ecial form table

callnextmethod table

dynamic tabledelete

dynamiclet tablep

tableref

dynamicsetq

if tan

tanh

labels

inheritance

lambda

thread

letcc

thread

nextmethodp

threadp

progn

threadreschedule

function call

threadstart

quote

threadvalue

setq

throw

unwindprotect

top dynamic

withhandler

top lexical

sp ecialize

truncate

sp ecialize on

unless

sqrt

unquote

Standard ML

abbreviation with

standard mo dule

unquotesplicing

static error

abbreviation to

stream

unwindprotect

stream

variable

string

vector

string

vector

string

vector

hexinsertion character

vectorp

stringbegin glyph

vectorref

stringend glyph

wait

escaping in

when

hexadecimal notation in

denition of

stringescap e glyph

withhandler

stringappend

write

stringlt

writer

stringp

writeunit

stringref

zerop

stringslice

sub class

direct

indirect

sup erclass

direct

symb ol

symbol

symbol

symbolexistsp

symbolname

symbolp

syntax

external representations

generic function lamb dalist

identier

lamb dalist

character

constant

defmodule

doublefloat

pair

singleprecisioninteger

string

symbol

unquote

unquotesplicing

vector

syntax expansion

T