SlideShare una empresa de Scribd logo
1 de 24
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)))))
Clojure

Más contenido relacionado

La actualidad más candente

11 x1 t01 01 algebra & indices (2014)
11 x1 t01 01 algebra & indices (2014)11 x1 t01 01 algebra & indices (2014)
11 x1 t01 01 algebra & indices (2014)
Nigel Simmons
 
X2 t02 01 factorising complex expressions (2013)
X2 t02 01 factorising complex expressions (2013)X2 t02 01 factorising complex expressions (2013)
X2 t02 01 factorising complex expressions (2013)
Nigel Simmons
 
Funct format sql_statement.c
Funct format sql_statement.cFunct format sql_statement.c
Funct format sql_statement.c
albertinous
 
12X1 T01 01 log laws
12X1 T01 01 log laws12X1 T01 01 log laws
12X1 T01 01 log laws
Nigel Simmons
 
11 X1 T01 03 factorising (2010)
11 X1 T01 03 factorising (2010)11 X1 T01 03 factorising (2010)
11 X1 T01 03 factorising (2010)
Nigel Simmons
 
12X1 T01 03 integrating derivative on function
12X1 T01 03 integrating derivative on function12X1 T01 03 integrating derivative on function
12X1 T01 03 integrating derivative on function
Nigel Simmons
 

La actualidad más candente (15)

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

Destacado (9)

Bibliothcairesdufuturetfuturdesbibliothques 140617024643-phpapp02 (1)
Bibliothcairesdufuturetfuturdesbibliothques 140617024643-phpapp02 (1)Bibliothcairesdufuturetfuturdesbibliothques 140617024643-phpapp02 (1)
Bibliothcairesdufuturetfuturdesbibliothques 140617024643-phpapp02 (1)
 
Clojure workshop
Clojure workshopClojure workshop
Clojure workshop
 
Into Clojure
Into ClojureInto Clojure
Into Clojure
 
Scala introduction
Scala introductionScala introduction
Scala introduction
 
Likwidacja linii tramwaju szybkiego w Zielonej Górze
Likwidacja linii tramwaju szybkiego w Zielonej GórzeLikwidacja linii tramwaju szybkiego w Zielonej Górze
Likwidacja linii tramwaju szybkiego w Zielonej Górze
 
Clojure - JVM språket som er "multi-core ready"
Clojure - JVM språket som er "multi-core ready"Clojure - JVM språket som er "multi-core ready"
Clojure - JVM språket som er "multi-core ready"
 
Paralell collections in Scala
Paralell collections in ScalaParalell collections in Scala
Paralell collections in Scala
 
The account problem in Java and Clojure
The account problem in Java and ClojureThe account problem in Java and Clojure
The account problem in Java and Clojure
 
Logi
LogiLogi
Logi
 

Similar a Learning Lisp

comp diff
comp diffcomp diff
comp diff
dianenz
 
Compfuncdiff
CompfuncdiffCompfuncdiff
Compfuncdiff
dianenz
 
Intro to Functional Programming Workshop (code4lib)
Intro to Functional Programming Workshop (code4lib)Intro to Functional Programming Workshop (code4lib)
Intro to Functional Programming Workshop (code4lib)
Will Kurt
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)関数潮流(Function Tendency)
関数潮流(Function Tendency)
riue
 

Similar a Learning Lisp (20)

comp diff
comp diffcomp diff
comp diff
 
Compfuncdiff
CompfuncdiffCompfuncdiff
Compfuncdiff
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
 
Ecma script 5
Ecma script 5Ecma script 5
Ecma script 5
 
funwithalgorithms.pptx
funwithalgorithms.pptxfunwithalgorithms.pptx
funwithalgorithms.pptx
 
4.1 inverse functions t
4.1 inverse functions t4.1 inverse functions t
4.1 inverse functions t
 
Relasi Fungsi.ppt
Relasi Fungsi.pptRelasi Fungsi.ppt
Relasi Fungsi.ppt
 
Relasi Fungsi.ppt
Relasi Fungsi.pptRelasi Fungsi.ppt
Relasi Fungsi.ppt
 
Intro to Functional Programming Workshop (code4lib)
Intro to Functional Programming Workshop (code4lib)Intro to Functional Programming Workshop (code4lib)
Intro to Functional Programming Workshop (code4lib)
 
Ejercicios resueltos
Ejercicios resueltosEjercicios resueltos
Ejercicios resueltos
 
Htdp01
Htdp01Htdp01
Htdp01
 
Root locus of_dynamic_systems
Root locus of_dynamic_systemsRoot locus of_dynamic_systems
Root locus of_dynamic_systems
 
1.7 sign charts of factorable formulas t
1.7 sign charts of factorable formulas t1.7 sign charts of factorable formulas t
1.7 sign charts of factorable formulas t
 
ゲーム理論BASIC 第19回 -有限回繰り返しゲーム-
ゲーム理論BASIC 第19回 -有限回繰り返しゲーム-ゲーム理論BASIC 第19回 -有限回繰り返しゲーム-
ゲーム理論BASIC 第19回 -有限回繰り返しゲーム-
 
Full Stack Clojure
Full Stack ClojureFull Stack Clojure
Full Stack Clojure
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)関数潮流(Function Tendency)
関数潮流(Function Tendency)
 
Ah unit 1 differentiation
Ah unit 1 differentiationAh unit 1 differentiation
Ah unit 1 differentiation
 
Zero Theorem and Rational Roots Presentation
Zero Theorem and Rational Roots PresentationZero Theorem and Rational Roots Presentation
Zero Theorem and Rational Roots Presentation
 
Modul 3 quadratic function
Modul 3 quadratic functionModul 3 quadratic function
Modul 3 quadratic function
 
Week-5-Inverse-Function-NGY.pptx
Week-5-Inverse-Function-NGY.pptxWeek-5-Inverse-Function-NGY.pptx
Week-5-Inverse-Function-NGY.pptx
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Learning Lisp

Notas del editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. Cambridge polish notation\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. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. Parens are actually literals for lists.\nData and code has the same representation.\n
  24. Parens are actually literals for lists.\nData and code has the same representation.\n
  25. Compile time metaprogrammering - ingen performance overhead\nMan bruker vanlige funksjoner til å manipulere kode, på samme måte som data\n\n\n\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. \n
  29. \n
  30. \n