SlideShare a Scribd company logo
Learning Lisp
  Alf Kristian Støyle
sum(1, 2);
sum(1, 2)
(sum 1, 2)
(sum 1   2)
(sum 1   2)
(sum 1 2)
Prefix notation
Function name   Parameters


     (sum 1 2)
(sum 1 2)
(sum)


(sum 1 2)


(sum 1 2 3)
(sum)
;=> 0
(sum 1 2)
;=> 3
(sum 1 2 3)
;=> 6
(+)
;=> 0
(+ 1 2)
;=> 3
(+ 1 2 3)
;=> 6
(+)
;=> 0
(+ 1 2)     1 + 2
;=> 3
(+ 1 2 3)   1 + 2 + 3
;=> 6
Lists

'(3 2 1)
;=> (3 2 1)

(+ 3 2 1)
;=> 6
Lists

'(3 2 1)
;=> (3 2 1)

(+ 3 2 1)
;=> 6


(defn iterate
  [f x] (cons x (lazy-seq (iterate f (f x)))))
Lists

'(3 2 1)
;=> (3 2 1)

(+ 3 2 1)
;=> 6


(defn iterate
  [f x] (cons x (lazy-seq (iterate f (f x)))))
Macros

(1 + 2)
Macros

(infix (1 + 2))
;=> 3
Macros

(infix (1 + 2))
;=> 3

(defmacro infix [form]
  `(~(second form) ~(first form) ~@(nnext form)))
Macros

(infix (1 + 2))
;=> 3

(defmacro infix [form]
  `(~(second form) ~(first form) ~@(nnext form)))

(macroexpand '(infix (1 + 2)))
;=> (+ 1 2)
(defn iterate
  [f x] (cons x (lazy-seq (iterate f (f x)))))
Abstract syntax tree

(defn iterate
  [f x] (cons x (lazy-seq (iterate f (f x)))))
Learning Lisp
Clojure

More Related Content

DOCX
Lispprograaming excercise
KEY
PAIP 第1章 Lisp入門
PPTX
Python data structures
PPTX
Macrobrew: Clojure macros distilled
PDF
Regexp Master
PDF
Calculus :Tutorial 2
PDF
X2 t02 03 roots & coefficients (2013)
PDF
X2 t02 02 multiple roots (2013)
Lispprograaming excercise
PAIP 第1章 Lisp入門
Python data structures
Macrobrew: Clojure macros distilled
Regexp Master
Calculus :Tutorial 2
X2 t02 03 roots & coefficients (2013)
X2 t02 02 multiple roots (2013)

What's hot (15)

PDF
11 x1 t01 01 algebra & indices (2014)
PDF
X2 t02 01 factorising complex expressions (2013)
PPT
Comp decomp worked
PPTX
TCO in Python via bytecode manipulation.
PDF
Funct format sql_statement.c
PDF
12X1 T01 01 log laws
PDF
11 X1 T01 03 factorising (2010)
PDF
The Chain Rule, Part 2
PPTX
Python 培训讲义
PDF
12X1 T01 03 integrating derivative on function
PPTX
PPT
CS201- Introduction to Programming- Lecture 17
PPT
11 things about 11gr2
PDF
Haskell 101
PPT
Python легко и просто. Красиво решаем повседневные задачи
11 x1 t01 01 algebra & indices (2014)
X2 t02 01 factorising complex expressions (2013)
Comp decomp worked
TCO in Python via bytecode manipulation.
Funct format sql_statement.c
12X1 T01 01 log laws
11 X1 T01 03 factorising (2010)
The Chain Rule, Part 2
Python 培训讲义
12X1 T01 03 integrating derivative on function
CS201- Introduction to Programming- Lecture 17
11 things about 11gr2
Haskell 101
Python легко и просто. Красиво решаем повседневные задачи
Ad

Viewers also liked (9)

PDF
Bibliothcairesdufuturetfuturdesbibliothques 140617024643-phpapp02 (1)
KEY
Clojure workshop
KEY
Into Clojure
ODP
Scala introduction
PPT
Likwidacja linii tramwaju szybkiego w Zielonej Górze
KEY
Clojure - JVM språket som er "multi-core ready"
PDF
Paralell collections in Scala
ZIP
The account problem in Java and Clojure
DOCX
Bibliothcairesdufuturetfuturdesbibliothques 140617024643-phpapp02 (1)
Clojure workshop
Into Clojure
Scala introduction
Likwidacja linii tramwaju szybkiego w Zielonej Górze
Clojure - JVM språket som er "multi-core ready"
Paralell collections in Scala
The account problem in Java and Clojure
Ad

Similar to Learning Lisp (20)

PDF
The Magnificent Seven
PPTX
Functional Programming.pptx
PDF
Clojure: The Art of Abstraction
PDF
KEY
CoqUn2010
PDF
On Functional Programming - A Clojurian Perspective
PPTX
Clojure to Slang
ODP
Recursion and Functional Programming
PDF
Continuation Passing Style and Macros in Clojure - Jan 2012
PPTX
PDF
Advanced
PDF
Slaying the Dragon: Implementing a Programming Language in Ruby
PDF
Introduction To Lisp
PDF
Iteration
PPTX
AI Programming language (LISP)
PDF
Clojure intro
PDF
Advanced features of Lisp functions Advanced features of Lisp functions
PPTX
AI UNIT-4 Final (2).pptx
KEY
Clojure Intro
PDF
Clojure values
The Magnificent Seven
Functional Programming.pptx
Clojure: The Art of Abstraction
CoqUn2010
On Functional Programming - A Clojurian Perspective
Clojure to Slang
Recursion and Functional Programming
Continuation Passing Style and Macros in Clojure - Jan 2012
Advanced
Slaying the Dragon: Implementing a Programming Language in Ruby
Introduction To Lisp
Iteration
AI Programming language (LISP)
Clojure intro
Advanced features of Lisp functions Advanced features of Lisp functions
AI UNIT-4 Final (2).pptx
Clojure Intro
Clojure values

Recently uploaded (20)

PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Encapsulation theory and applications.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Spectroscopy.pptx food analysis technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPT
Teaching material agriculture food technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
MYSQL Presentation for SQL database connectivity
PDF
cuic standard and advanced reporting.pdf
PDF
Empathic Computing: Creating Shared Understanding
Spectral efficient network and resource selection model in 5G networks
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Per capita expenditure prediction using model stacking based on satellite ima...
sap open course for s4hana steps from ECC to s4
Encapsulation theory and applications.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Understanding_Digital_Forensics_Presentation.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Spectroscopy.pptx food analysis technology
Encapsulation_ Review paper, used for researhc scholars
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Digital-Transformation-Roadmap-for-Companies.pptx
Teaching material agriculture food technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
MYSQL Presentation for SQL database connectivity
cuic standard and advanced reporting.pdf
Empathic Computing: Creating Shared Understanding

Learning Lisp

Editor's Notes

  • #2: \n
  • #3: \n
  • #4: \n
  • #5: \n
  • #6: \n
  • #7: Cambridge polish notation\n
  • #8: Cambridge polish notation\n
  • #9: Cambridge polish notation\n
  • #10: Cambridge polish notation\n
  • #11: Cambridge polish notation\n
  • #12: Cambridge polish notation\n
  • #13: Cambridge polish notation\n
  • #14: Cambridge polish notation\n
  • #15: Cambridge polish notation\n
  • #16: Cambridge polish notation\n
  • #17: Cambridge polish notation\n
  • #18: Cambridge polish notation\n
  • #19: \n
  • #20: \n
  • #21: \n
  • #22: \n
  • #23: \n
  • #24: Parens are actually literals for lists.\nData and code has the same representation.\n
  • #25: Parens are actually literals for lists.\nData and code has the same representation.\n
  • #26: Compile time metaprogrammering - ingen performance overhead\nMan bruker vanlige funksjoner til å manipulere kode, på samme måte som data\n\n\n\n
  • #27: Compile time metaprogrammering - ingen performance overhead\nMan bruker vanlige funksjoner til å manipulere kode, på samme måte som data\n\n\n\n
  • #28: Compile time metaprogrammering - ingen performance overhead\nMan bruker vanlige funksjoner til å manipulere kode, på samme måte som data\n\n\n\n
  • #29: \n
  • #30: \n
  • #31: \n