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
310
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
190
Clubot
sbryant
4
260
Other Decks in Programming
See All in Programming
Micro Frontends for Java Microservices - Devnexus 2024
mraible
PRO
0
500
ONE WEDGE_company_guide
1wedge_one
0
500
Java 22 Overview
kishida
1
190
はてなにおける CSS Modules、及び CSS Modules に足りないもの / CSS Modules in Hatena, and CSS Modules missing parts
mizdra
7
940
Azure OpenAI Serviceのプロンプトエンジニアリング入門
tomokusaba
3
770
Git Lint
bkuhlmann
4
750
VSCodeでのDatabricks開発もお勧めしたい/I would also recommend Databricks development with VSCode.
kazumain
0
260
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Development with a Focus on OpenAPI
seike460
PRO
2
170
MicrosoftのPlatform Engineeringガイドを読んで実際になにかやってみた
ymd65536
1
400
TCAとKMPを用いた新規動画配信アプリ 「ABEMA Live」の設計
tomu28
1
110
SwiftUIで使いやすいToastの作り方 / How to build a Toast system which is easy to use in SwiftUI
lovee
3
150
PHPはいつから死んでいるかの調査
chiroruxx
1
400
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
68
8.6k
The Pragmatic Product Professional
lauravandoore
25
5.8k
YesSQL, Process and Tooling at Scale
rocio
164
13k
How to name files
jennybc
65
93k
The Power of CSS Pseudo Elements
geoffreycrofte
60
5k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
30
6k
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3.1k
Bootstrapping a Software Product
garrettdimon
PRO
302
110k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
221
21k
Optimizing for Happiness
mojombo
370
69k
Facilitating Awesome Meetings
lara
42
5.6k
The Language of Interfaces
destraynor
151
23k
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