Allegro CL Certification Program

8/1/2005


Click here to start


Table of Contents

Allegro CL Certification Program

Goals for Level 2

Format of the Course

Session 1 (today)

Session 2

Session 3

Homework

Getting Allegro Common Lisp

Allegro CL Certification Program

Ways to define functions

Defun

Argument List

Keyword Arguments

Keyword Arguments

Keyword Detail

Optional Arguments

Optional Arguments

Other possibilities

Optional and Keyword Arguments

&rest example

&rest Arguments

Pointers to Functions

Pointers to Functions

Calling a Function by its Pointer

Using Function References

Function References

Lambdas

Lambda - Example

Where do you use lambdas

Other Functions of Functions

fboundp

fdefinition

fmakunbound

Symbol-function

Global .vs. Local Functions

Local Functions - labels

SETF Functions

SETF Function Definition

Using SETF

Many Operations in Lisp itself are setf-enabled

The Idea of Mapping Functions

mapcar

maphash

The Idea of Multiple Values

multiple-value-setq

Multiple-Value-Bind

Allegro CL Certification Program

User-defined structures

Structures

defstruct with default values

Structures

defstruct with type

defstruct with type and name

Hash tables

Hash table examples

gethashís Multiple values

Hash Table Fns

clrhash

Hash table iteration example

maphash

Allegro CL Certification Program

Bits and Bytes

Bits of Integers

Bit Combination

Bit Testing

Byte Manipulation with ldb

Byte Manipulation

Shift Operation

How Many Bits?

Vectors of Bits

Allegro CL Certification Program

What are Macros?

Macroexpansion

Macro Evaluation is Different

Recursive Macros

Macroexpand function

macro functions

Macro Examples

Backquote

Backquote example

,@

&body

with-open-file example

Macro Examples

Macro Examples

Macro Examples

Iteration Macro

Macro Argument Lists

Macros with Logic

Macro writing problems

Macros are not Functions

Donít evaluate more than once

Variable Capture

Generate symbols that canít be captured

Turning Functions into Macros

When to Use Macros

When to use macros

Problems with using Macros

Redefining Macros

learning more

Allegro CL Certification Program

A Macro is not a Function

Macro Recursion is not like Function Recursion

Valid Macro Recursion

Multiple Evaluation

Order of Evaluation

Avoid Destroying Arg Lists

Variable Capture

Global Variable Capture

Avoiding Global Variable Capture

Avoiding Variable Capture with Gensym

Avoiding Variable Capture with Scope

Variable capture example

SETF: a special kind of macro

Builtin SETF operations

Rolling Your Own

Using DEFSETF

Allegro CL Certification Program

What Are Closures?

A Simple Closure

What Happened?

Another Example

Now What Happened?

Implicit Closures

Closures and Garbage

Closure Example 1

Closure Examples 2

Closure Examples 3

Cool Example

Example

URL for homework and slides

Author: Franz Inc.

Email: info@franz.com

Home Page: http://franz.com