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
Practical Tips and Tricks for Working with Compose Multiplatform Previews (mDevCamp 2025)
stewemetal
0
120
Cloudflare Realtime と Workers でつくるサーバーレス WebRTC
nekoya3
0
390
コードに語らせよう――自己ドキュメント化が内包する楽しさについて / Let the Code Speak
nrslib
6
1.4k
2度もゼロから書き直して、やっとブラウザでぬるぬる動くAIに辿り着いた話
tomoino
0
160
AIエージェントによるテストフレームワーク Arbigent
takahirom
0
370
ワンバイナリWebサービスのススメ
mackee
10
7.7k
生成AIコーディングとの向き合い方、AIと共創するという考え方 / How to deal with generative AI coding and the concept of co-creating with AI
seike460
PRO
1
190
WindowInsetsだってテストしたい
ryunen344
1
110
型付きアクターモデルがもたらす分散シミュレーションの未来
piyo7
0
760
統一感のある Go コードを生成 AI の力で手にいれる
otakakot
0
3k
AIコーディング道場勉強会#2 君(エンジニア)たちはどう生きるか
misakiotb
1
130
Webからモバイルへ Vue.js × Capacitor 活用事例
naokihaba
0
540
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
Six Lessons from altMBA
skipperchong
28
3.8k
Faster Mobile Websites
deanohume
307
31k
Side Projects
sachag
454
42k
Code Review Best Practice
trishagee
68
18k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
It's Worth the Effort
3n
184
28k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Site-Speed That Sticks
csswizardry
10
630
BBQ
matthewcrist
89
9.7k
Practical Orchestrator
shlominoach
188
11k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
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