SlideShare a Scribd company logo
Introduction to LISP
OverviewAGENDAHistoryIntroductionLisp FeaturesSyntaxComparison structuresLambda expressionsConses and ListsList processing proceduresSummaryLisp applications
Lisp was invented by John McCarthy in 1958 while he was at the MIT.McCarthy published its design in a paper in Communications of the ACM in 1960.Lisp was first implemented by Steve Russell on an IBM 704 computer.Connection to AI:Lisp was closely connected to AI research communities, especially on PDP-10 systems.Lisp was used as the implementation of the programming language Micro Planner  which was used in the famous AI system SHRUDLU.Over its fifty-year history, lisp has spawned many variations on the core theme of an S-expression language. Lisp history
A Lisp machine at the MIT museum
Introduction to Lisp(List processing)Lisp is second oldest  high-level programming languages with a long history and a distinctive, fully parenthesized syntax.Lisp is a Tool to solve some of the most difficult problems in the world of computing.It is an example of elegant, minimalist language.Lisp is one of the most popular programming languages that is used for Artificial intelligence.
Lisp featuresBuilt in support for Lists.Atomic storage management.Dynamic TypingUniform syntax.Interactive environment.ExtensibilityStandard macros.Special forms(loop, do, dotimes..)
Syntax (Data structures)Lists are surrounded by parenthesis.Ex: (),(()),((a,b,c)),((1,2),3,4) are all Lists.Atoms are string of characters beginning with letter, digit or special characters other than left “(“ and right “)” Ex: (a b c d) is a list of four elements(atoms) a,b,c,d      Peace       Of       Mind        6678Prefix notation is followed in Lisp.Operators first, followed by the arguments.Ex: (+ 4 5)  adds 4 to 5      (/ 12 6)2
Function DefinitionList represents function calls as well as basic data structures.(factorial 4)12(+4 2)6Definition of a function(defun <f-name><parameter-list><body>)Ex: (defun square(X)              (*XX))          SQUARE>(square2)4>(square(square 2))16
Function inside functionEx: (+3(40)6)49      (+3(+3 3)4)13Addition, subtraction and multiplication process2*3366
Comparing functionsThe comparison symbols are( => ,< ,> ,=<, >= ,<= )These function return either True(T) or Nil.Ex: (= 4 4)T        (< 4 4)NIL        (> 5 1)T        (>= 6 3)T        (<= 4 3)NIL
Other comparison functionUn-equality function( \=)Returns TRUE if values are not equal else NIL if values are equal.Division function(/)Ex: (/4 2) 2Max: It takes the maximum value of some numbersEx: (Max -3 3 40 150 -100)150Min: It takes the minimum value of some numbersEx: (Min 3 4 10 -5)-5
Assigning functions:Syntax: setq( argument)Ex: (setq a 3)3      (* a 4)12Explicit evaluation call;(eval a)3Note: A quoted value is always kept untouched.(setq b ‘(+ a 4))(+ a 4)
4 equality predicates: (=, equal, eq, eql) for numerical values only.Ex:(= 2 4/2) T(setf a (1 2)) (1 2)(setf b (1 2)) (1 2)(equal a b)T(eql 3 9/3)T
Nil represents false and an empty list.Ex:(null nil)T(null())T(null ‘(a b))NIL(not ‘(a b))NIL
Lambda expressionsLambda operator is used to bind variables to values which are then evaluated within an expression.Arguments to lambda are list of arguments, and the expression or expressions to which the function evaluates. (lambda (arg) (arg+1)) evaluates to the function that, when applied takes one argument , binds it to arg and returns the number one greater then that argument.Ex: (lambda (arg) (arg+1) 4)5
Conses and listsA lisp list is a singly linked list, Each cell of this list is called a Cons, is composed of two pointers, called the car and cdr.If the given cons is taken to be the head of the linked list, then its car points to the first element of the list, and its cdr points to the rest of the List.A variable which refers to the list is simply a pointer to the first cons of the list.Parenthesized  S-expressions represent Linked list structure.
List-processing proceduresList can be directly created with the list procedure, which takes any number of arguments and returns the list of these arguments.Ex: (List 1 2 ‘ a 3) ( 1 2 a 3)     (List 1 ‘ (2 3) 4)(1 (2 3) 4)For the linked lists cons procedure can be used to add an element to the front of the list.Ex: (cons 1 ‘ (2 3))(1 2 3)Append procedure append two or more lists to one another.Ex: (append ‘ (1 2) ‘ (3 4))(1 2 3 4)
Basic lisp examplesBasic hello world program(print “Hello world”)To evaluate factorial on a number(n)(defun factorial (n)         (if (<= n 1)             1            (* n (factorial(- n 1)))))//iterative version  which uses common Lisp’s Loop Macro//(defun factorial (n)         (loop for I from 1 to n            for fac=1 then (* fac i)            finally (return fac)))//using recursive function//(defun –reverse (list)           (let  ((return –value  ‘()))              (dolist  (e list) (push e return-value))                 return-value))
Lisp SummarySimple syntax.  so, its very easy to parse.Programming in Lisp is distinguished from other programming languages due to its unique syntax and development mode.The interchangeability of code and data also gives Lisp instantly recognizable syntax. All lisp program code is written as S-expressions , or parenthesized lists.
Applications of Lisp programmingCommon Lisp is used to develop research applications(often in Artificial Intelligence)For rapid development of prototypesLisp language is often used in interactive command line, which may be combined with an IDE.Common Lisp is used in many commercial applications, Including the Yahoo! Store Web-commerce site.Other visible applications people have developed using Lisp are:Emacs
G2

More Related Content

PPTX
LISP: Introduction to lisp
DataminingTools Inc
 
PPT
Advance LISP (Artificial Intelligence)
wahab khan
 
PPT
(Ai lisp)
Ravi Rao
 
PPTX
Lisp
huzaifa ramzan
 
PPT
INTRODUCTION TO LISP
Nilt1234
 
PPTX
LISP: Input And Output
DataminingTools Inc
 
PPT
Lisp
Fraboni Ec
 
PPTX
A brief introduction to lisp language
David Gu
 
LISP: Introduction to lisp
DataminingTools Inc
 
Advance LISP (Artificial Intelligence)
wahab khan
 
(Ai lisp)
Ravi Rao
 
INTRODUCTION TO LISP
Nilt1234
 
LISP: Input And Output
DataminingTools Inc
 
A brief introduction to lisp language
David Gu
 

What's hot (20)

PPTX
LISP: Data types in lisp
DataminingTools Inc
 
ODP
Introduction to Programming in LISP
Knoldus Inc.
 
PPTX
Lisp
sonukumar142
 
PPTX
Prolog & lisp
Ismail El Gayar
 
PDF
Gentle Introduction To Lisp
Damien Garaud
 
PPT
Lisp Programming Languge
Yaser Jaradeh
 
PDF
Learn a language : LISP
Devnology
 
PPTX
Basic lisp
Arvind sahu
 
PDF
Lecture11 syntax analysis_7
Mahesh Kumar Chelimilla
 
PPTX
Functional Programming Concepts for Imperative Programmers
Chris
 
PPTX
Compiler Design LR parsing SLR ,LALR CLR
Riazul Islam
 
PPT
Bottom - Up Parsing
kunj desai
 
PPTX
Scheme language
JITENDRA LENKA
 
PPTX
LR(1) and SLR(1) parsing
R Islam
 
PPT
Chapter 6 intermediate code generation
Vipul Naik
 
PPTX
Scheme Programming Language
Reham AlBlehid
 
PPTX
Optimization of dfa
Kiran Acharya
 
PPTX
Back patching
santhiya thavanthi
 
LISP: Data types in lisp
DataminingTools Inc
 
Introduction to Programming in LISP
Knoldus Inc.
 
Prolog & lisp
Ismail El Gayar
 
Gentle Introduction To Lisp
Damien Garaud
 
Lisp Programming Languge
Yaser Jaradeh
 
Learn a language : LISP
Devnology
 
Basic lisp
Arvind sahu
 
Lecture11 syntax analysis_7
Mahesh Kumar Chelimilla
 
Functional Programming Concepts for Imperative Programmers
Chris
 
Compiler Design LR parsing SLR ,LALR CLR
Riazul Islam
 
Bottom - Up Parsing
kunj desai
 
Scheme language
JITENDRA LENKA
 
LR(1) and SLR(1) parsing
R Islam
 
Chapter 6 intermediate code generation
Vipul Naik
 
Scheme Programming Language
Reham AlBlehid
 
Optimization of dfa
Kiran Acharya
 
Back patching
santhiya thavanthi
 
Ad

Viewers also liked (20)

PDF
Pitching Lovecraft
miker71
 
PPT
Beautiful Picture
sam ran
 
PDF
Petitions stellungnahme -beilage_2_komitee
Chemtrails Spoter
 
DOCX
Escribir en la escuela
María Eugenia Gallo Arbeláez
 
PPT
RIA - RDA - ROA
Didier Girard
 
PDF
A3 electrical AUDI A3 1997 2000 1.8 20V 4ADR
Gherghescu Gabriel
 
PDF
M-CARE newsletter 6
Karel Van Isacker
 
PDF
MMV Programbeskrivelse 2016-1 SDU
Jens Eybye
 
PPTX
Ana maria jaimes moreno
anita9m
 
PDF
Entrevista a Clare Allcard a La Vanguardia (30 desembre 2013)
quetxCB
 
DOCX
Guia de aprendizaje diagnostico
samy meza alvarez
 
PPT
Для родителей
Татьяна Левчук
 
PPT
Glói geimvera
nemandi
 
DOCX
Todo esta bien
zkaterin
 
DOCX
Jornada VII - Informática -CRUV
Diego
 
PPTX
Tecnologia
valentinapatriciatamayo
 
PPT
Blogs
Jota
 
PDF
Bearing witness to yahapalanaya
Sanjana Hattotuwa
 
PDF
Humor y valor (en situaciones de discapacidad).
José María
 
Pitching Lovecraft
miker71
 
Beautiful Picture
sam ran
 
Petitions stellungnahme -beilage_2_komitee
Chemtrails Spoter
 
Escribir en la escuela
María Eugenia Gallo Arbeláez
 
RIA - RDA - ROA
Didier Girard
 
A3 electrical AUDI A3 1997 2000 1.8 20V 4ADR
Gherghescu Gabriel
 
M-CARE newsletter 6
Karel Van Isacker
 
MMV Programbeskrivelse 2016-1 SDU
Jens Eybye
 
Ana maria jaimes moreno
anita9m
 
Entrevista a Clare Allcard a La Vanguardia (30 desembre 2013)
quetxCB
 
Guia de aprendizaje diagnostico
samy meza alvarez
 
Для родителей
Татьяна Левчук
 
Glói geimvera
nemandi
 
Todo esta bien
zkaterin
 
Jornada VII - Informática -CRUV
Diego
 
Blogs
Jota
 
Bearing witness to yahapalanaya
Sanjana Hattotuwa
 
Humor y valor (en situaciones de discapacidad).
José María
 
Ad

Similar to LISP: Introduction To Lisp (20)

PPTX
AI UNIT-4 Final (2).pptx
prakashvs7
 
PPT
Lisp and scheme i
Luis Goldster
 
PPTX
Advanced Programming_Basics of functional Programming.pptx
ManjishPal
 
PPTX
Report about the LISP Programming Language
maldosmelandrew
 
PDF
15 functional programming
jigeno
 
PDF
15 functional programming
jigeno
 
PDF
Basic and logical implementation of r language
Md. Mahedi Mahfuj
 
DOCX
Cs6660 compiler design may june 2016 Answer Key
appasami
 
PPTX
Lecture 2 lisp-Overview
Student at University Of Malakand, Pakistan
 
PPT
Functional Programming Languages slidesslies.ppt
BikalAdhikari4
 
PDF
Advanced features of Lisp functions Advanced features of Lisp functions
CvDs3
 
PDF
Morel, a data-parallel programming language
Julian Hyde
 
PDF
Real Time Big Data Management
Albert Bifet
 
DOCX
Mastering C# Lambda Expressions: A Complete Guide
LetsUpdateSkills
 
PDF
Python Basics
tusharpanda88
 
PPTX
R Programming Language
NareshKarela1
 
PDF
Programming in Scala - Lecture Two
Angelo Corsaro
 
PPTX
Special topics in finance lecture 2
Dr. Muhammad Ali Tirmizi., Ph.D.
 
PPTX
R basics for MBA Students[1].pptx
rajalakshmi5921
 
DOCX
CSC8503 Principles of Programming Languages Semester 1, 2015.docx
faithxdunce63732
 
AI UNIT-4 Final (2).pptx
prakashvs7
 
Lisp and scheme i
Luis Goldster
 
Advanced Programming_Basics of functional Programming.pptx
ManjishPal
 
Report about the LISP Programming Language
maldosmelandrew
 
15 functional programming
jigeno
 
15 functional programming
jigeno
 
Basic and logical implementation of r language
Md. Mahedi Mahfuj
 
Cs6660 compiler design may june 2016 Answer Key
appasami
 
Functional Programming Languages slidesslies.ppt
BikalAdhikari4
 
Advanced features of Lisp functions Advanced features of Lisp functions
CvDs3
 
Morel, a data-parallel programming language
Julian Hyde
 
Real Time Big Data Management
Albert Bifet
 
Mastering C# Lambda Expressions: A Complete Guide
LetsUpdateSkills
 
Python Basics
tusharpanda88
 
R Programming Language
NareshKarela1
 
Programming in Scala - Lecture Two
Angelo Corsaro
 
Special topics in finance lecture 2
Dr. Muhammad Ali Tirmizi., Ph.D.
 
R basics for MBA Students[1].pptx
rajalakshmi5921
 
CSC8503 Principles of Programming Languages Semester 1, 2015.docx
faithxdunce63732
 

More from LISP Content (13)

PPTX
LISP: Control Structures In Lisp
LISP Content
 
PPTX
LISP:Declarations In Lisp
LISP Content
 
PPTX
LISP: Errors In Lisp
LISP Content
 
PPTX
LISP: Input And Output
LISP Content
 
PPTX
LISP: Object Sytstem Lisp
LISP Content
 
PPTX
LISP: Loops In Lisp
LISP Content
 
PPTX
LISP: Type specifiers in lisp
LISP Content
 
PPTX
LISP: Symbols and packages in lisp
LISP Content
 
PPTX
LISP: Scope and extent in lisp
LISP Content
 
PPTX
LISP: Program structure in lisp
LISP Content
 
PPTX
LISP: Predicates in lisp
LISP Content
 
PPTX
LISP: Macros in lisp
LISP Content
 
PPTX
LISP: Data types in lisp
LISP Content
 
LISP: Control Structures In Lisp
LISP Content
 
LISP:Declarations In Lisp
LISP Content
 
LISP: Errors In Lisp
LISP Content
 
LISP: Input And Output
LISP Content
 
LISP: Object Sytstem Lisp
LISP Content
 
LISP: Loops In Lisp
LISP Content
 
LISP: Type specifiers in lisp
LISP Content
 
LISP: Symbols and packages in lisp
LISP Content
 
LISP: Scope and extent in lisp
LISP Content
 
LISP: Program structure in lisp
LISP Content
 
LISP: Predicates in lisp
LISP Content
 
LISP: Macros in lisp
LISP Content
 
LISP: Data types in lisp
LISP Content
 

Recently uploaded (20)

PPTX
How to Build a Scalable Micro-Investing Platform in 2025 - A Founder’s Guide ...
Third Rock Techkno
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
Software Development Company | KodekX
KodekX
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PPTX
Coupa-Overview _Assumptions presentation
annapureddyn
 
PDF
This slide provides an overview Technology
mineshkharadi333
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PPTX
IoT Sensor Integration 2025 Powering Smart Tech and Industrial Automation.pptx
Rejig Digital
 
How to Build a Scalable Micro-Investing Platform in 2025 - A Founder’s Guide ...
Third Rock Techkno
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
Software Development Company | KodekX
KodekX
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Coupa-Overview _Assumptions presentation
annapureddyn
 
This slide provides an overview Technology
mineshkharadi333
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
IoT Sensor Integration 2025 Powering Smart Tech and Industrial Automation.pptx
Rejig Digital
 

LISP: Introduction To Lisp

  • 2. OverviewAGENDAHistoryIntroductionLisp FeaturesSyntaxComparison structuresLambda expressionsConses and ListsList processing proceduresSummaryLisp applications
  • 3. Lisp was invented by John McCarthy in 1958 while he was at the MIT.McCarthy published its design in a paper in Communications of the ACM in 1960.Lisp was first implemented by Steve Russell on an IBM 704 computer.Connection to AI:Lisp was closely connected to AI research communities, especially on PDP-10 systems.Lisp was used as the implementation of the programming language Micro Planner which was used in the famous AI system SHRUDLU.Over its fifty-year history, lisp has spawned many variations on the core theme of an S-expression language. Lisp history
  • 4. A Lisp machine at the MIT museum
  • 5. Introduction to Lisp(List processing)Lisp is second oldest high-level programming languages with a long history and a distinctive, fully parenthesized syntax.Lisp is a Tool to solve some of the most difficult problems in the world of computing.It is an example of elegant, minimalist language.Lisp is one of the most popular programming languages that is used for Artificial intelligence.
  • 6. Lisp featuresBuilt in support for Lists.Atomic storage management.Dynamic TypingUniform syntax.Interactive environment.ExtensibilityStandard macros.Special forms(loop, do, dotimes..)
  • 7. Syntax (Data structures)Lists are surrounded by parenthesis.Ex: (),(()),((a,b,c)),((1,2),3,4) are all Lists.Atoms are string of characters beginning with letter, digit or special characters other than left “(“ and right “)” Ex: (a b c d) is a list of four elements(atoms) a,b,c,d Peace Of Mind 6678Prefix notation is followed in Lisp.Operators first, followed by the arguments.Ex: (+ 4 5)  adds 4 to 5 (/ 12 6)2
  • 8. Function DefinitionList represents function calls as well as basic data structures.(factorial 4)12(+4 2)6Definition of a function(defun <f-name><parameter-list><body>)Ex: (defun square(X) (*XX)) SQUARE>(square2)4>(square(square 2))16
  • 9. Function inside functionEx: (+3(40)6)49 (+3(+3 3)4)13Addition, subtraction and multiplication process2*3366
  • 10. Comparing functionsThe comparison symbols are( => ,< ,> ,=<, >= ,<= )These function return either True(T) or Nil.Ex: (= 4 4)T (< 4 4)NIL (> 5 1)T (>= 6 3)T (<= 4 3)NIL
  • 11. Other comparison functionUn-equality function( \=)Returns TRUE if values are not equal else NIL if values are equal.Division function(/)Ex: (/4 2) 2Max: It takes the maximum value of some numbersEx: (Max -3 3 40 150 -100)150Min: It takes the minimum value of some numbersEx: (Min 3 4 10 -5)-5
  • 12. Assigning functions:Syntax: setq( argument)Ex: (setq a 3)3 (* a 4)12Explicit evaluation call;(eval a)3Note: A quoted value is always kept untouched.(setq b ‘(+ a 4))(+ a 4)
  • 13. 4 equality predicates: (=, equal, eq, eql) for numerical values only.Ex:(= 2 4/2) T(setf a (1 2)) (1 2)(setf b (1 2)) (1 2)(equal a b)T(eql 3 9/3)T
  • 14. Nil represents false and an empty list.Ex:(null nil)T(null())T(null ‘(a b))NIL(not ‘(a b))NIL
  • 15. Lambda expressionsLambda operator is used to bind variables to values which are then evaluated within an expression.Arguments to lambda are list of arguments, and the expression or expressions to which the function evaluates. (lambda (arg) (arg+1)) evaluates to the function that, when applied takes one argument , binds it to arg and returns the number one greater then that argument.Ex: (lambda (arg) (arg+1) 4)5
  • 16. Conses and listsA lisp list is a singly linked list, Each cell of this list is called a Cons, is composed of two pointers, called the car and cdr.If the given cons is taken to be the head of the linked list, then its car points to the first element of the list, and its cdr points to the rest of the List.A variable which refers to the list is simply a pointer to the first cons of the list.Parenthesized S-expressions represent Linked list structure.
  • 17. List-processing proceduresList can be directly created with the list procedure, which takes any number of arguments and returns the list of these arguments.Ex: (List 1 2 ‘ a 3) ( 1 2 a 3) (List 1 ‘ (2 3) 4)(1 (2 3) 4)For the linked lists cons procedure can be used to add an element to the front of the list.Ex: (cons 1 ‘ (2 3))(1 2 3)Append procedure append two or more lists to one another.Ex: (append ‘ (1 2) ‘ (3 4))(1 2 3 4)
  • 18. Basic lisp examplesBasic hello world program(print “Hello world”)To evaluate factorial on a number(n)(defun factorial (n) (if (<= n 1) 1 (* n (factorial(- n 1)))))//iterative version which uses common Lisp’s Loop Macro//(defun factorial (n) (loop for I from 1 to n for fac=1 then (* fac i) finally (return fac)))//using recursive function//(defun –reverse (list) (let ((return –value ‘())) (dolist (e list) (push e return-value)) return-value))
  • 19. Lisp SummarySimple syntax. so, its very easy to parse.Programming in Lisp is distinguished from other programming languages due to its unique syntax and development mode.The interchangeability of code and data also gives Lisp instantly recognizable syntax. All lisp program code is written as S-expressions , or parenthesized lists.
  • 20. Applications of Lisp programmingCommon Lisp is used to develop research applications(often in Artificial Intelligence)For rapid development of prototypesLisp language is often used in interactive command line, which may be combined with an IDE.Common Lisp is used in many commercial applications, Including the Yahoo! Store Web-commerce site.Other visible applications people have developed using Lisp are:Emacs
  • 21. G2
  • 23. Igor EngraverPick a tutorial of your choice and browse through it at your own pace.The tutorials section is free, self-guiding and will not involve any additional support.Visit us at www.dataminingtools.netVisit more self help tutorials