Allegro CL Certification Program


Click here to start

Table of Contents

Allegro CL Certification Program

1. Define a Class

2. Make an Instance

3. Define a Subclass

4. Use Methods

5. Use Method Combination

6. Initialize Instances

7. Use Slot-Value

About Slot-Value

8. Use SETF methods

9. Use Multiple Dispatch

10. Use Multiple Inheritance

Allegro CL Certification Program

Common Lisp Object System


Classes and Instances


Class Inheritance

CLOS Supports Multiple Inheritance

Supporting Type-Specific Behavior

CLOS Generic Functions Support Modular Definitions

CLOS Generates Dispatch Code

Dispatch on Multiple Arguments

Method Combination

Class Precedence Lists

Defining a class

Defining a slot

defclass Options

Defining the Interface

Defining the Implementation


Accessing and Changing Slot Values

Example - Squares

Constructor Function

Example - Rectangles

Example - Method

Example - Method Inheritance

Getting the class of an object



Other slot functions

:ACCESSOR Slot Option

:INITFORM Slot Option

:INITARG Slot Option

:ALLOCATION slot option

Alternate approach


Multiple Dispatch

Dispatching on Class T

Dispatch Using EQL

Dispatch Using EQL, cont’d.

:BEFORE and :AFTER methods

Order of Before and After

:AROUND methods

Primary methods call-next-method

Call-next-method with arguments

call-next-method example

SETF Methods



print-object Support

Inheritance and Combining Methods

Class Precedence List

Class Precedence Lists

Precendence example

Putting it all together

Some Guidelines on API

Reasons to Use Class Hierarchies

Allegro CL Certification Program

Congruence of Method Argument Lists

Congruency examples

Keyword Congruency Examples

Specialization of Slots

Using a Shared Slot

Inheritance of Shared Slots

Specializing Shared Slots to Local Slots



Changing Generic Functions

Changing Methods




Almost All Built-in Types Have Corresponding Classes

Inheritance for Built-in Types

Defstruct defines classes

But Structure Accessors are not Generic

Allegro CL Certification Program

Avoid typep

Avoid Slot-value

Avoid Multipurpose Slots

Use Constructors

Add Print-object Methods

Use EQL Methods With Symbols

Peter Norvig’s Lisp Style Maxims

The Goal

Author: Franz Inc.


Home Page: