Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Zero to Common Lisp
Search
Sean Bryant
December 05, 2011
Programming
4
330
Zero to Common Lisp
How common lisp projects are put together.
Sean Bryant
December 05, 2011
Tweet
Share
More Decks by Sean Bryant
See All by Sean Bryant
NST
sbryant
2
210
Clubot
sbryant
4
270
Other Decks in Programming
See All in Programming
『自分のデータだけ見せたい!』を叶える──Laravel × Casbin で複雑権限をスッキリ解きほぐす 25 分
akitotsukahara
1
600
なんとなくわかった気になるブロックテーマ入門/contents.nagoya 2025 6.28
chiilog
1
250
来たるべき 8.0 に備えて React 19 新機能と React Router 固有機能の取捨選択とすり合わせを考える
oukayuka
2
880
既存デザインを変更せずにタップ領域を広げる方法
tahia910
1
260
童醫院敏捷轉型的實踐經驗
cclai999
0
210
Benchmark
sysong
0
280
PicoRuby on Rails
makicamel
2
120
“いい感じ“な定量評価を求めて - Four Keysとアウトカムの間の探求 -
nealle
0
500
生成AIコーディングとの向き合い方、AIと共創するという考え方 / How to deal with generative AI coding and the concept of co-creating with AI
seike460
PRO
1
350
WebViewの現在地 - SwiftUI時代のWebKit - / The Current State Of WebView
marcy731
0
110
AIプログラマーDevinは PHPerの夢を見るか?
shinyasaita
1
180
deno-redisの紹介とJSRパッケージの運用について (toranoana.deno #21)
uki00a
0
170
Featured
See All Featured
Side Projects
sachag
455
42k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
Stop Working from a Prison Cell
hatefulcrawdad
270
20k
Six Lessons from altMBA
skipperchong
28
3.9k
Measuring & Analyzing Core Web Vitals
bluesmoon
7
500
Art, The Web, and Tiny UX
lynnandtonic
299
21k
Rails Girls Zürich Keynote
gr2m
94
14k
Scaling GitHub
holman
459
140k
A Modern Web Designer's Workflow
chriscoyier
694
190k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
940
Unsuck your backbone
ammeep
671
58k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
Transcript
Zero To Common Lisp How Common Lisp projects are put
together.
About Me.
About Me. •Programmer at Vitrue.
About Me. •Programmer at Vitrue. •One of the resident “lisp
dudes”
About Me. •Programmer at Vitrue. •One of the resident “lisp
dudes” •A new lisper
About Me. •Programmer at Vitrue. •One of the resident “lisp
dudes” •A new lisper •First lisp presentation
Going to Talk About:
Going to Talk About: Files, Images and Packages
Going to Talk About: Files, Images and Packages CLOS -
Just the basics.
Going to Talk About: Files, Images and Packages CLOS -
Just the basics. Asdf & Quicklisp.
Going to Talk About: Files, Images and Packages CLOS -
Just the basics. Asdf & Quicklisp. Quickproject
Files Lisp doesn’t care about your files. Maybe it cares
a little. ASDF cares. More on that later.
Packages Mapping of symbols *package* - Current package. Symbol Import/
Export interface No global package Common-Lisp-User Supports Inheritance Using a package Importing Shadowing
(defpackage :clcss (:use :cl) (:export :read-css)) (in-package :clcss)
None
Images
Images Dump/load frozen state
Images Dump/load frozen state Distribute a “native” app.
Images Dump/load frozen state Distribute a “native” app. Always working
with one
Images Dump/load frozen state Distribute a “native” app. Always working
with one Similar to Smalltalk
Images Dump/load frozen state Distribute a “native” app. Always working
with one Similar to Smalltalk FFI is a pain the ass.
CLOS The worst introduction ever.
CLOS Common Lisp Object System The worst introduction ever.
CLOS Common Lisp Object System Objects do not have methods
The worst introduction ever.
CLOS Common Lisp Object System Objects do not have methods
Instead Lisp has generic functions The worst introduction ever.
CLOS Common Lisp Object System Objects do not have methods
Instead Lisp has generic functions defgeneric The worst introduction ever.
CLOS Common Lisp Object System Objects do not have methods
Instead Lisp has generic functions defgeneric declares options and arguments for methods The worst introduction ever.
CLOS Common Lisp Object System Objects do not have methods
Instead Lisp has generic functions defgeneric declares options and arguments for methods defmethod The worst introduction ever.
(defclass my-class () ((my-slot :initform t :accessor my-slot :documentation “A
simple slot.”)) (:documentation “A simple class”))
defmethod
defmethod specializes generic function based on type of object
defmethod specializes generic function based on type of object not
restricted a single type multi-methods
defmethod specializes generic function based on type of object not
restricted a single type multi-methods eql specializers, specialize to particular instances of objects.
defmethod specializes generic function based on type of object not
restricted a single type multi-methods eql specializers, specialize to particular instances of objects. combinators :before, :around, :after allow for hooking into method calls.
(defmethod initialize-instance :after ((o my-class) &key) ...) Custom constructor (defmethod
slot->nil ((o my-class)) (setf (my-slot o) nil)) A simple method. method combinator
ASDF Almost a standard*
ASDF Another System Definition Facility Almost a standard*
ASDF Another System Definition Facility Organize your code, through files...
Almost a standard*
ASDF Another System Definition Facility Organize your code, through files...
Understanding the object model is key. Almost a standard*
ASDF Another System Definition Facility Organize your code, through files...
Understanding the object model is key. Components Almost a standard*
ASDF Another System Definition Facility Organize your code, through files...
Understanding the object model is key. Components Operations Almost a standard*
ASDF Another System Definition Facility Organize your code, through files...
Understanding the object model is key. Components Operations Extensible Almost a standard*
(defsystem #:clcss :name "clcss" :version "0.0.0" :depends-on (:cl-ppcre) :in-order-to ((test-op
(load-op clcss-tests))) :components ((:module "src" :components ((:file "package") (:file "clcss" :depends-on ("package")))))) (defmethod perform ((o asdf:test-op) (c (eql (asdf:find-system :clcss)))) (funcall (intern (symbol-name :run-all) :clcss-tests))) Example ASD
defsystem form
defsystem form Usual meta-data :author :description :version :maintainer
defsystem form Usual meta-data :author :description :version :maintainer :perform -
stub out custom functionality
defsystem form Usual meta-data :author :description :version :maintainer :perform -
stub out custom functionality Components root of all other components.
defsystem form Usual meta-data :author :description :version :maintainer :perform -
stub out custom functionality Components root of all other components. :serial :depends-on :in-order to
defsystem form Usual meta-data :author :description :version :maintainer :perform -
stub out custom functionality Components root of all other components. :serial :depends-on :in-order to Grammar is short, easy to reference.
Components
Components Modules - Directories.
Components Modules - Directories. Files Defaults to cl-source-file Static files
- README, ChangeLog etc.
Components Modules - Directories. Files Defaults to cl-source-file Static files
- README, ChangeLog etc. Systems*
Components Modules - Directories. Files Defaults to cl-source-file Static files
- README, ChangeLog etc. Systems* *Systems are actually special modules
Operations load-op compile-op load-source-op test-op
Perform (defgeneric perform (operation component)) Now all together! Because it’s
CLOS we can change it. Test operations are the most common.
(defsystem #:clcss :name "clcss" :version "0.0.0" :depends-on (:cl-ppcre) :in-order-to ((test-op
(load-op clcss-tests))) :components ((:module "src" :components ((:file "package") (:file "clcss" :depends-on ("package")))))) (defmethod perform ((o asdf:test-op) (c (eql (asdf:find-system :clcss)))) (funcall (intern (symbol-name :run-all) :clcss-tests)))
ASDF Usage (asdf:oos ‘asdf:load-op :clcss) operate on system (asdf:load-system :clcss)
A short-cut to oos.
The ASDF Source Registry How ASDF finds your systems.
If you put software in ~/ .local/share/common-lisp/source/ You’re done.
Most likely you don’t. Shove configuration files in: ~/.config/common-lisp/source-registry.conf.d/ Or
set CL_SOURCE_REGISTRY Files end in .conf by convention Examples directives (:directory “/path/to/source/”) (:tree “/path/to/tree/of/sources/”)
Quicklisp It’s your gem, pip, lenin, cabal... Speaks ASDF ASDF
+ Quicklisp == Bundler-ish ASDF + Quicklisp == pip + requirements.txt
Using QL (ql:quickload :clcss) It really is that easy.
Starting out
Quickproject From the guy who brought you quicklisp Bare-bones project
skeleton. Great starting point. https:/ /github.com/xach/quickproject
Quickproject (quickproject:make-project #p"src/screenscraper/" :depends-on '(cl-ppcre drakma closure-html))
Simple things don’t need to be projects. (load #p”/path/to/script”) Sometimes
is all you want.
Q&A You can find me here: @sean_bryant