SlideShare une entreprise Scribd logo
1  sur  21
Introduction to LISP
Overview AGENDA History Introduction Lisp Features Syntax Comparison structures Lambda expressions Conses and Lists List processing procedures Summary Lisp 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 features Built in support for Lists. Atomic storage management. Dynamic Typing Uniform syntax. Interactive environment. Extensibility Standard 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         6678 Prefix notation is followed in Lisp. Operators first, followed by the arguments. Ex: (+ 4 5)  adds 4 to 5       (/ 12 6)2
Function Definition List represents function calls as well as basic data structures. (factorial 4)12 (+4 2)6 Definition of a function (defun <f-name><parameter-list><body>) Ex: (defun square(X)               (*XX))           SQUARE >(square2)4 >(square(square 2))16
Function inside function Ex: (+3(40)6)49       (+3(+3 3)4)13 Addition, subtraction and multiplication process 2*3 36 6
Comparing functions The 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 function ,[object Object],Returns TRUE if values are not equal else NIL if values are equal. ,[object Object],Ex: (/4 2) 2 ,[object Object],Ex: (Max -3 3 40 150 -100)150 ,[object Object],Ex: (Min 3 4 10 -5)-5
Assigning functions: Syntax: setq( argument) Ex: (setq a 3)3       (* a 4)12 Explicit evaluation call; (eval a)3 Note: 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 expressions Lambda 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 lists A 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 procedures List 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 examples Basic hello world program(print “Hello world”) To evaluate factorial on a number(n) ,[object Object],         (if (<= n 1)              1             (* n (factorial(- n 1))))) //iterative version  which uses common Lisp’s Loop Macro// ,[object Object],         (loop for I from 1 to n             for fac=1 then (* fac i)             finally (return fac))) //using recursive function// ,[object Object],           (let  ((return –value  ‘()))               (dolist  (e list) (push e return-value))                  return-value))
Lisp Summary Simple 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 programming Common Lisp is used to develop research applications(often in Artificial Intelligence) For rapid development of prototypes Lisp 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: ,[object Object]
G2

Contenu connexe

Tendances

Tendances (20)

linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computation
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
 
Type Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLikeType Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLike
 
Introduction to prolog
Introduction to prologIntroduction to prolog
Introduction to prolog
 
Syntax directed translation
Syntax directed translationSyntax directed translation
Syntax directed translation
 
Bottom up parser
Bottom up parserBottom up parser
Bottom up parser
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
Algorithms Lecture 4: Sorting Algorithms I
Algorithms Lecture 4: Sorting Algorithms IAlgorithms Lecture 4: Sorting Algorithms I
Algorithms Lecture 4: Sorting Algorithms I
 
Object-oriented concepts
Object-oriented conceptsObject-oriented concepts
Object-oriented concepts
 
Parsing in Compiler Design
Parsing in Compiler DesignParsing in Compiler Design
Parsing in Compiler Design
 
Post Machine
Post MachinePost Machine
Post Machine
 
Lisp
LispLisp
Lisp
 
Relational Algebra & Calculus
Relational Algebra & CalculusRelational Algebra & Calculus
Relational Algebra & Calculus
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
Sorting
SortingSorting
Sorting
 
Prolog Programming : Basics
Prolog Programming : BasicsProlog Programming : Basics
Prolog Programming : Basics
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Insertion sort algorithm power point presentation
Insertion  sort algorithm power point presentation Insertion  sort algorithm power point presentation
Insertion sort algorithm power point presentation
 
Ordbms
OrdbmsOrdbms
Ordbms
 

Similaire à LISP: Introduction to lisp

AI UNIT-4 Final (2).pptx
AI UNIT-4 Final (2).pptxAI UNIT-4 Final (2).pptx
AI UNIT-4 Final (2).pptxprakashvs7
 
A brief introduction to lisp language
A brief introduction to lisp languageA brief introduction to lisp language
A brief introduction to lisp languageDavid Gu
 
15 functional programming
15 functional programming15 functional programming
15 functional programmingjigeno
 
15 functional programming
15 functional programming15 functional programming
15 functional programmingjigeno
 
Basic and logical implementation of r language
Basic and logical implementation of r language Basic and logical implementation of r language
Basic and logical implementation of r language Md. Mahedi Mahfuj
 
Introduction to Programming in LISP
Introduction to Programming in LISPIntroduction to Programming in LISP
Introduction to Programming in LISPKnoldus Inc.
 
Cs6660 compiler design may june 2016 Answer Key
Cs6660 compiler design may june 2016 Answer KeyCs6660 compiler design may june 2016 Answer Key
Cs6660 compiler design may june 2016 Answer Keyappasami
 
Functional Programming Languages slidesslies.ppt
Functional Programming Languages slidesslies.pptFunctional Programming Languages slidesslies.ppt
Functional Programming Languages slidesslies.pptBikalAdhikari4
 
Morel, a data-parallel programming language
Morel, a data-parallel programming languageMorel, a data-parallel programming language
Morel, a data-parallel programming languageJulian Hyde
 
Real Time Big Data Management
Real Time Big Data ManagementReal Time Big Data Management
Real Time Big Data ManagementAlbert Bifet
 
Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence) Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence) wahab khan
 
R Programming Language
R Programming LanguageR Programming Language
R Programming LanguageNareshKarela1
 
Programming in Scala - Lecture Two
Programming in Scala - Lecture TwoProgramming in Scala - Lecture Two
Programming in Scala - Lecture TwoAngelo Corsaro
 

Similaire à LISP: Introduction to lisp (20)

AI UNIT-4 Final (2).pptx
AI UNIT-4 Final (2).pptxAI UNIT-4 Final (2).pptx
AI UNIT-4 Final (2).pptx
 
Lisp and scheme i
Lisp and scheme iLisp and scheme i
Lisp and scheme i
 
Lisp
LispLisp
Lisp
 
A brief introduction to lisp language
A brief introduction to lisp languageA brief introduction to lisp language
A brief introduction to lisp language
 
15 functional programming
15 functional programming15 functional programming
15 functional programming
 
15 functional programming
15 functional programming15 functional programming
15 functional programming
 
Basic and logical implementation of r language
Basic and logical implementation of r language Basic and logical implementation of r language
Basic and logical implementation of r language
 
Introduction to Programming in LISP
Introduction to Programming in LISPIntroduction to Programming in LISP
Introduction to Programming in LISP
 
Scheme language
Scheme languageScheme language
Scheme language
 
Cs6660 compiler design may june 2016 Answer Key
Cs6660 compiler design may june 2016 Answer KeyCs6660 compiler design may june 2016 Answer Key
Cs6660 compiler design may june 2016 Answer Key
 
Lecture 2 lisp-Overview
Lecture 2 lisp-OverviewLecture 2 lisp-Overview
Lecture 2 lisp-Overview
 
Functional Programming Languages slidesslies.ppt
Functional Programming Languages slidesslies.pptFunctional Programming Languages slidesslies.ppt
Functional Programming Languages slidesslies.ppt
 
Morel, a data-parallel programming language
Morel, a data-parallel programming languageMorel, a data-parallel programming language
Morel, a data-parallel programming language
 
Real Time Big Data Management
Real Time Big Data ManagementReal Time Big Data Management
Real Time Big Data Management
 
(Ai lisp)
(Ai lisp)(Ai lisp)
(Ai lisp)
 
Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence) Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence)
 
Python Basics
Python BasicsPython Basics
Python Basics
 
R Programming Language
R Programming LanguageR Programming Language
R Programming Language
 
Programming in Scala - Lecture Two
Programming in Scala - Lecture TwoProgramming in Scala - Lecture Two
Programming in Scala - Lecture Two
 
Special topics in finance lecture 2
Special topics in finance   lecture 2Special topics in finance   lecture 2
Special topics in finance lecture 2
 

Plus de DataminingTools Inc

AI: Introduction to artificial intelligence
AI: Introduction to artificial intelligenceAI: Introduction to artificial intelligence
AI: Introduction to artificial intelligenceDataminingTools Inc
 
Data Mining: Text and web mining
Data Mining: Text and web miningData Mining: Text and web mining
Data Mining: Text and web miningDataminingTools Inc
 
Data Mining: Mining stream time series and sequence data
Data Mining: Mining stream time series and sequence dataData Mining: Mining stream time series and sequence data
Data Mining: Mining stream time series and sequence dataDataminingTools Inc
 
Data Mining: Mining ,associations, and correlations
Data Mining: Mining ,associations, and correlationsData Mining: Mining ,associations, and correlations
Data Mining: Mining ,associations, and correlationsDataminingTools Inc
 
Data Mining: Graph mining and social network analysis
Data Mining: Graph mining and social network analysisData Mining: Graph mining and social network analysis
Data Mining: Graph mining and social network analysisDataminingTools Inc
 
Data warehouse and olap technology
Data warehouse and olap technologyData warehouse and olap technology
Data warehouse and olap technologyDataminingTools Inc
 

Plus de DataminingTools Inc (20)

Terminology Machine Learning
Terminology Machine LearningTerminology Machine Learning
Terminology Machine Learning
 
Techniques Machine Learning
Techniques Machine LearningTechniques Machine Learning
Techniques Machine Learning
 
Machine learning Introduction
Machine learning IntroductionMachine learning Introduction
Machine learning Introduction
 
Areas of machine leanring
Areas of machine leanringAreas of machine leanring
Areas of machine leanring
 
AI: Planning and AI
AI: Planning and AIAI: Planning and AI
AI: Planning and AI
 
AI: Logic in AI 2
AI: Logic in AI 2AI: Logic in AI 2
AI: Logic in AI 2
 
AI: Logic in AI
AI: Logic in AIAI: Logic in AI
AI: Logic in AI
 
AI: Learning in AI 2
AI: Learning in AI 2AI: Learning in AI 2
AI: Learning in AI 2
 
AI: Learning in AI
AI: Learning in AI AI: Learning in AI
AI: Learning in AI
 
AI: Introduction to artificial intelligence
AI: Introduction to artificial intelligenceAI: Introduction to artificial intelligence
AI: Introduction to artificial intelligence
 
AI: Belief Networks
AI: Belief NetworksAI: Belief Networks
AI: Belief Networks
 
AI: AI & Searching
AI: AI & SearchingAI: AI & Searching
AI: AI & Searching
 
AI: AI & Problem Solving
AI: AI & Problem SolvingAI: AI & Problem Solving
AI: AI & Problem Solving
 
Data Mining: Text and web mining
Data Mining: Text and web miningData Mining: Text and web mining
Data Mining: Text and web mining
 
Data Mining: Outlier analysis
Data Mining: Outlier analysisData Mining: Outlier analysis
Data Mining: Outlier analysis
 
Data Mining: Mining stream time series and sequence data
Data Mining: Mining stream time series and sequence dataData Mining: Mining stream time series and sequence data
Data Mining: Mining stream time series and sequence data
 
Data Mining: Mining ,associations, and correlations
Data Mining: Mining ,associations, and correlationsData Mining: Mining ,associations, and correlations
Data Mining: Mining ,associations, and correlations
 
Data Mining: Graph mining and social network analysis
Data Mining: Graph mining and social network analysisData Mining: Graph mining and social network analysis
Data Mining: Graph mining and social network analysis
 
Data warehouse and olap technology
Data warehouse and olap technologyData warehouse and olap technology
Data warehouse and olap technology
 
Data Mining: Data processing
Data Mining: Data processingData Mining: Data processing
Data Mining: Data processing
 

Dernier

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 

Dernier (20)

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 

LISP: Introduction to lisp

  • 2. Overview AGENDA History Introduction Lisp Features Syntax Comparison structures Lambda expressions Conses and Lists List processing procedures Summary Lisp 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 features Built in support for Lists. Atomic storage management. Dynamic Typing Uniform syntax. Interactive environment. Extensibility Standard 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 6678 Prefix notation is followed in Lisp. Operators first, followed by the arguments. Ex: (+ 4 5)  adds 4 to 5 (/ 12 6)2
  • 8. Function Definition List represents function calls as well as basic data structures. (factorial 4)12 (+4 2)6 Definition of a function (defun <f-name><parameter-list><body>) Ex: (defun square(X) (*XX)) SQUARE >(square2)4 >(square(square 2))16
  • 9. Function inside function Ex: (+3(40)6)49 (+3(+3 3)4)13 Addition, subtraction and multiplication process 2*3 36 6
  • 10. Comparing functions The 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.
  • 12. Assigning functions: Syntax: setq( argument) Ex: (setq a 3)3 (* a 4)12 Explicit evaluation call; (eval a)3 Note: 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 expressions Lambda 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 lists A 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 procedures List 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.
  • 19. Lisp Summary Simple 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.
  • 21. G2
  • 23.