SlideShare a Scribd company logo
TES3111 October 2001
Artificial Intelligence
LISPLISP
TES3111 October 2001
Lisp resources
• We will use an implementation of LISP called
Allegro Common LISP.
• Different LISP interpreters include - Eg
interpreter: Allegro LISP, Harlequin LISP,
Corman Lisp.
→Text books:
⇒ANSI Common LISP, P.Graham, Prentice Hall, 1995
(recommended)
⇒Common LISP:the language, G.L. Steele, Digital Press,
1990 (2nd Edition)
TES3111 October 2001
Lisp resources-cont
⇒Common LISP: A gentle introduction to Symbolic
Computing, David Touretzky, Addison Wesley, 1990.
⇒Paradigms of Artificial Intelligence Programming: Case
Studies in Common LISP, Peter Norvig, Academic
Press/Morgan Kaufmann, 1992.
TES3111 October 2001
Useful websites for LISP
• Allegro Lisp download
– http://www.franz.com/downloads/
• Association of LISP users
– http://www.alu.org
• Common LISP Open Code Collection
– http://clocc.sourceforge.net
• AI special interest group of the ACM -
– http://www.sigart.acm.org
TES3111 October 2001
1. Lisp is interactive
• There is an interpreter that evaluates inputs. An
input is processes in 3 steps:
1. Reads input and construct expression from the input.
2. Evaluates the expression for meaning.
3. Prints the results of the evaluation, including signaling
of erros if necessary.
• These 3 steps can be customized by the
programmer.
TES3111 October 2001
2. Lisp is a dynamic language
• Programs are developed incrementally, by making
small changes to the source code.
• Interpreter evaluates the changed definitions and
then immediately run the results.
• New definitions and data structures can be added
at any time.
• This features are ideal for prototyping.
TES3111 October 2001
3. Lisp has symbols
• Symbols are the basic type of data in use.
• Symbols are used to build bigger, more
complex expressions.
• Example of symbols:
– HELLO
– 23-worldofsports
TES3111 October 2001
4. LISP has lists
• Lists are delimited using parenthesis (…).
Anything can be placed in a list, including other
lists (nested lists). For example:
(1 orange 2 3)
(once (upon a) time)
• Empty list is represented as ()
• Caution: elements within a list are separated with
a white space, and NOT a comma ,
TES3111 October 2001
5. Lisp classifies data
• It does not classify variables.
• A variable is just a symbol. It can hold any type of
value.
• A variable do not have to be declared before it is
used.
• Lisp defines different types of data (rather than
defining different types of variables)
TES3111 October 2001
5. Lisp classifies data - contd
Lisp Expression
number symbol sequence
integer
float
ratio
keyword
list vector
string
TES3111 October 2001
5. Lisp classifies data - contd
• Integer - a counting number like 1, 2 ,3 …100, -23
• float - real number. Example 1.59, -100.3
• ratio - a fraction, example 99/23, 4/5
• symbol - a sequence of alphanumeric characters, eg: BOO,
ID4…
• keyword - a symbol prefixed with a colon. Eg- :BOO, :ID4
• list - a collection of zero or m ore expressions inside (..)
• vector - 1 dimensional collection of expressions in
sequential memory
• string - a vector of 0 or more characters inside “ ”
TES3111 October 2001
6. Lisp uses prefix notation
• Operators appear in front of their operands.
• The infix (10 + 3) is written as (+ 10 3)
TES3111 October 2001
7. Lisp is functional
• Lisp functions take data, operates on it, and return the
results. The returned results are called function values.
• Functions can return any number of values.
• To call a function, place it as the first element of an input
list, followed by its operands. Example:
(+ 100 99 88)
(setf x (+ 2 3))
• All operations are done through functions
TES3111 October 2001
8. Programs and data
• Lisp makes no distinction between programs and data.
• A program can be treated as a set of instruction or as a list
of symbols.
• This makes it possible to write programs that generate
another program, or programs that analyze other programs.
TES3111 October 2001
9. Lisp evaluation is easy to understand
• Rule 1 :
If an expression is a constant, the interpreter will return the value of
the constant. No more rules apply.
Examples: ‘socrates, 4.5
• Rule 2:
If Rule 1 is not applicable, and the expression is a symbol, then Lisp
treats the symbol as a variable and no more rules are considered. If
the variable has a value, Lisp will return that value. Otherwise it
will report an error.
TES3111 October 2001
9. Lisp evaluation is easy to understand
• Rule 3:
If Rule 1 and Rule 2 do not apply and the expression is a LIST, then
Lisp treats it as a function call and no more rules are considered.
– You should at this point remember that the first element in the list
is assumed to be a defined a function. The remaining elements are
data. Each expression in the data is evaluated left to right.
• Rule 4:
If Rules 1 to 3 do not apply, then there is an error!
TES3111 October 2001
10. Lisp is easy to learn???
• How to study and program in Lisp?
– Read the first few chapters of a good introductory Lisp
book.
– Read up the definition of each Lisp function that you
encounter.
– Start developing a good programming style from the
very start!
TES3111 October 2001
Data Structures
S-Expression - Symbolic expression. It can
be an Atom, a List or a collection of S-
Expression enclosed by (…)
Atom - String of characters beginning with a
letter, digit. Eg:
Artificial, intelligence, 31416..etc.
TES3111 October 2001
Data Structures
List - a collection of S-Expression enclosed
by ( …. ). Eg:
(One of these days)
(one ((two) three) four)
TES3111 October 2001
Basic Operations
 A LISP program contains functions applied to its
arguments.
 Functions return LISP objects.
 2 types of functions - PREDICATE and
COMMANDS
TES3111 October 2001
Predicate
A function that tests for some condition involving its
arguments and returns
– Nil if the condition is FALSE (Nil stands for FALSE)
– True for any other case. In LISP TRUE is represented
using a special LISP variable T.
TES3111 October 2001
Command
• A command performs operations on its arguments
and returns an S-expression.
• Format of a command is:
(<Command> Arg1 Arg2 … Argn)
Note: All commands and predicates must be
enclosed in (…). To differentiate from lists… a
list is preceded with a single quote ‘
Eg : (CAR a b c) versus ‘(CAR a b c)
TES3111 October 2001
Function - CAR
CAR - returns the first element of a list. Examples:
• (CAR ‘(a b c d e))
• (CAR ‘((an orange) a day))
• (CAR '(1 (2 3 (4 5)) 6))
• (CAR ‘())
Note that in the last example, the argument to CAR is a null-
list.

More Related Content

What's hot

LISP Programming Language (Artificial Intelligence)
LISP Programming Language (Artificial Intelligence)LISP Programming Language (Artificial Intelligence)
LISP Programming Language (Artificial Intelligence)
wahab khan
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
Poojith Chowdhary
 
stack & queue
stack & queuestack & queue
stack & queue
manju rani
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysissumitbardhan
 
LR Parsing
LR ParsingLR Parsing
LR Parsing
Eelco Visser
 
Bubble sort
Bubble sortBubble sort
Bubble sort
Manek Ar
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
Vineeta Garg
 
Stacks and Queue - Data Structures
Stacks and Queue - Data StructuresStacks and Queue - Data Structures
Stacks and Queue - Data Structures
Dr. Jasmine Beulah Gnanadurai
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
karthikeyanC40
 
Parsing
ParsingParsing
Parsing
khush_boo31
 
Dbms architecture
Dbms architectureDbms architecture
Dbms architecture
Shubham Dwivedi
 
sparse matrix in data structure
sparse matrix in data structuresparse matrix in data structure
sparse matrix in data structure
MAHALAKSHMI P
 
Data Structures (BE)
Data Structures (BE)Data Structures (BE)
Data Structures (BE)
PRABHAHARAN429
 
Top down parsing
Top down parsingTop down parsing
Top down parsing
LakshmiSamivel
 
Complexity analysis - The Big O Notation
Complexity analysis - The Big O NotationComplexity analysis - The Big O Notation
Complexity analysis - The Big O Notation
Jawad Khan
 
1.2 steps and functionalities
1.2 steps and functionalities1.2 steps and functionalities
1.2 steps and functionalities
Krish_ver2
 
Data Structure (Queue)
Data Structure (Queue)Data Structure (Queue)
Data Structure (Queue)
Adam Mukharil Bachtiar
 
Declarative programming language
Declarative programming languageDeclarative programming language
Declarative programming language
Vinisha Pathak
 
Engineering C-programing module1 ppt (18CPS13/23)
Engineering C-programing module1 ppt (18CPS13/23)Engineering C-programing module1 ppt (18CPS13/23)
Engineering C-programing module1 ppt (18CPS13/23)
kavya R
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
Archit Saxena
 

What's hot (20)

LISP Programming Language (Artificial Intelligence)
LISP Programming Language (Artificial Intelligence)LISP Programming Language (Artificial Intelligence)
LISP Programming Language (Artificial Intelligence)
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
stack & queue
stack & queuestack & queue
stack & queue
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysis
 
LR Parsing
LR ParsingLR Parsing
LR Parsing
 
Bubble sort
Bubble sortBubble sort
Bubble sort
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
 
Stacks and Queue - Data Structures
Stacks and Queue - Data StructuresStacks and Queue - Data Structures
Stacks and Queue - Data Structures
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
 
Parsing
ParsingParsing
Parsing
 
Dbms architecture
Dbms architectureDbms architecture
Dbms architecture
 
sparse matrix in data structure
sparse matrix in data structuresparse matrix in data structure
sparse matrix in data structure
 
Data Structures (BE)
Data Structures (BE)Data Structures (BE)
Data Structures (BE)
 
Top down parsing
Top down parsingTop down parsing
Top down parsing
 
Complexity analysis - The Big O Notation
Complexity analysis - The Big O NotationComplexity analysis - The Big O Notation
Complexity analysis - The Big O Notation
 
1.2 steps and functionalities
1.2 steps and functionalities1.2 steps and functionalities
1.2 steps and functionalities
 
Data Structure (Queue)
Data Structure (Queue)Data Structure (Queue)
Data Structure (Queue)
 
Declarative programming language
Declarative programming languageDeclarative programming language
Declarative programming language
 
Engineering C-programing module1 ppt (18CPS13/23)
Engineering C-programing module1 ppt (18CPS13/23)Engineering C-programing module1 ppt (18CPS13/23)
Engineering C-programing module1 ppt (18CPS13/23)
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
 

Viewers also liked

Phd transfer seminar July 2016
Phd transfer seminar July 2016Phd transfer seminar July 2016
Phd transfer seminar July 2016
Tim Curtis
 
Redesigning Common Lisp
Redesigning Common LispRedesigning Common Lisp
Redesigning Common Lisp
fukamachi
 
LISP:Program structure in lisp
LISP:Program structure in lispLISP:Program structure in lisp
LISP:Program structure in lisp
DataminingTools Inc
 
A Little Lisp
A Little LispA Little Lisp
A Little Lisp
melbournepatterns
 
Introduction To Lisp
Introduction To LispIntroduction To Lisp
Introduction To Lisp
kyleburton
 

Viewers also liked (6)

Phd transfer seminar July 2016
Phd transfer seminar July 2016Phd transfer seminar July 2016
Phd transfer seminar July 2016
 
Redesigning Common Lisp
Redesigning Common LispRedesigning Common Lisp
Redesigning Common Lisp
 
LISP:Program structure in lisp
LISP:Program structure in lispLISP:Program structure in lisp
LISP:Program structure in lisp
 
A Little Lisp
A Little LispA Little Lisp
A Little Lisp
 
Introduction To Lisp
Introduction To LispIntroduction To Lisp
Introduction To Lisp
 
Prolog & lisp
Prolog & lispProlog & lisp
Prolog & lisp
 

Similar to Lisp

Lisp
LispLisp
Lisp Programming Languge
Lisp Programming LangugeLisp Programming Languge
Lisp Programming Languge
Yaser Jaradeh
 
AI UNIT-4 Final (2).pptx
AI UNIT-4 Final (2).pptxAI UNIT-4 Final (2).pptx
AI UNIT-4 Final (2).pptx
prakashvs7
 
Lisp and scheme i
Lisp and scheme iLisp and scheme i
Lisp and scheme i
Luis Goldster
 
Lisp, An Introduction.ppt
Lisp, An Introduction.pptLisp, An Introduction.ppt
Lisp, An Introduction.ppt
Luis Soza
 
intro.ppt
intro.pptintro.ppt
intro.ppt
Luis Soza
 
LISP: Introduction To Lisp
LISP: Introduction To LispLISP: Introduction To Lisp
LISP: Introduction To Lisp
LISP Content
 
parsing.pptx
parsing.pptxparsing.pptx
parsing.pptx
Aman564573
 
A brief introduction to lisp language
A brief introduction to lisp languageA brief introduction to lisp language
A brief introduction to lisp language
David Gu
 
AI Programming language (LISP)
AI Programming language (LISP)AI Programming language (LISP)
AI Programming language (LISP)
SURBHI SAROHA
 
Programming_Language_Syntax.ppt
Programming_Language_Syntax.pptProgramming_Language_Syntax.ppt
Programming_Language_Syntax.ppt
Amrita Sharma
 
Lecture 09 syntax analysis 05
Lecture 09 syntax analysis 05Lecture 09 syntax analysis 05
Lecture 09 syntax analysis 05
Iffat Anjum
 
Lists, Stacks, and Queues: Abstract Data Types
Lists, Stacks, and Queues: Abstract Data TypesLists, Stacks, and Queues: Abstract Data Types
Lists, Stacks, and Queues: Abstract Data Types
Hasan Dwi Cahyono
 
4 chapter3 list_stackqueuepart1
4 chapter3 list_stackqueuepart14 chapter3 list_stackqueuepart1
4 chapter3 list_stackqueuepart1
SSE_AndyLi
 
Bottom - Up Parsing
Bottom - Up ParsingBottom - Up Parsing
Bottom - Up Parsing
kunj desai
 
Ch-8.pdf
Ch-8.pdfCh-8.pdf
Mastering Python lesson 5a_lists_list_operations
Mastering Python lesson 5a_lists_list_operationsMastering Python lesson 5a_lists_list_operations
Mastering Python lesson 5a_lists_list_operations
Ruth Marvin
 
Lecture 2 lisp-Overview
Lecture 2 lisp-OverviewLecture 2 lisp-Overview
Data Structures 3
Data Structures 3Data Structures 3
Data Structures 3
Dr.Umadevi V
 

Similar to Lisp (20)

Lisp
LispLisp
Lisp
 
Lisp Programming Languge
Lisp Programming LangugeLisp Programming Languge
Lisp Programming Languge
 
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
 
intro.ppt
intro.pptintro.ppt
intro.ppt
 
Lisp, An Introduction.ppt
Lisp, An Introduction.pptLisp, An Introduction.ppt
Lisp, An Introduction.ppt
 
intro.ppt
intro.pptintro.ppt
intro.ppt
 
LISP: Introduction To Lisp
LISP: Introduction To LispLISP: Introduction To Lisp
LISP: Introduction To Lisp
 
parsing.pptx
parsing.pptxparsing.pptx
parsing.pptx
 
A brief introduction to lisp language
A brief introduction to lisp languageA brief introduction to lisp language
A brief introduction to lisp language
 
AI Programming language (LISP)
AI Programming language (LISP)AI Programming language (LISP)
AI Programming language (LISP)
 
Programming_Language_Syntax.ppt
Programming_Language_Syntax.pptProgramming_Language_Syntax.ppt
Programming_Language_Syntax.ppt
 
Lecture 09 syntax analysis 05
Lecture 09 syntax analysis 05Lecture 09 syntax analysis 05
Lecture 09 syntax analysis 05
 
Lists, Stacks, and Queues: Abstract Data Types
Lists, Stacks, and Queues: Abstract Data TypesLists, Stacks, and Queues: Abstract Data Types
Lists, Stacks, and Queues: Abstract Data Types
 
4 chapter3 list_stackqueuepart1
4 chapter3 list_stackqueuepart14 chapter3 list_stackqueuepart1
4 chapter3 list_stackqueuepart1
 
Bottom - Up Parsing
Bottom - Up ParsingBottom - Up Parsing
Bottom - Up Parsing
 
Ch-8.pdf
Ch-8.pdfCh-8.pdf
Ch-8.pdf
 
Mastering Python lesson 5a_lists_list_operations
Mastering Python lesson 5a_lists_list_operationsMastering Python lesson 5a_lists_list_operations
Mastering Python lesson 5a_lists_list_operations
 
Lecture 2 lisp-Overview
Lecture 2 lisp-OverviewLecture 2 lisp-Overview
Lecture 2 lisp-Overview
 
Data Structures 3
Data Structures 3Data Structures 3
Data Structures 3
 

More from Fraboni Ec

Hardware multithreading
Hardware multithreadingHardware multithreading
Hardware multithreading
Fraboni Ec
 
What is simultaneous multithreading
What is simultaneous multithreadingWhat is simultaneous multithreading
What is simultaneous multithreading
Fraboni Ec
 
Directory based cache coherence
Directory based cache coherenceDirectory based cache coherence
Directory based cache coherence
Fraboni Ec
 
Business analytics and data mining
Business analytics and data miningBusiness analytics and data mining
Business analytics and data mining
Fraboni Ec
 
Big picture of data mining
Big picture of data miningBig picture of data mining
Big picture of data mining
Fraboni Ec
 
Data mining and knowledge discovery
Data mining and knowledge discoveryData mining and knowledge discovery
Data mining and knowledge discovery
Fraboni Ec
 
Cache recap
Cache recapCache recap
Cache recap
Fraboni Ec
 
How analysis services caching works
How analysis services caching worksHow analysis services caching works
How analysis services caching works
Fraboni Ec
 
Hardware managed cache
Hardware managed cacheHardware managed cache
Hardware managed cache
Fraboni Ec
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
Fraboni Ec
 
Cobol, lisp, and python
Cobol, lisp, and pythonCobol, lisp, and python
Cobol, lisp, and python
Fraboni Ec
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
Fraboni Ec
 
Optimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessorsOptimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessors
Fraboni Ec
 
Abstraction file
Abstraction fileAbstraction file
Abstraction file
Fraboni Ec
 
Object model
Object modelObject model
Object model
Fraboni Ec
 
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
Fraboni Ec
 
Abstract class
Abstract classAbstract class
Abstract class
Fraboni Ec
 
Concurrency with java
Concurrency with javaConcurrency with java
Concurrency with java
Fraboni Ec
 
Inheritance
InheritanceInheritance
Inheritance
Fraboni Ec
 

More from Fraboni Ec (20)

Hardware multithreading
Hardware multithreadingHardware multithreading
Hardware multithreading
 
What is simultaneous multithreading
What is simultaneous multithreadingWhat is simultaneous multithreading
What is simultaneous multithreading
 
Directory based cache coherence
Directory based cache coherenceDirectory based cache coherence
Directory based cache coherence
 
Business analytics and data mining
Business analytics and data miningBusiness analytics and data mining
Business analytics and data mining
 
Big picture of data mining
Big picture of data miningBig picture of data mining
Big picture of data mining
 
Data mining and knowledge discovery
Data mining and knowledge discoveryData mining and knowledge discovery
Data mining and knowledge discovery
 
Cache recap
Cache recapCache recap
Cache recap
 
How analysis services caching works
How analysis services caching worksHow analysis services caching works
How analysis services caching works
 
Hardware managed cache
Hardware managed cacheHardware managed cache
Hardware managed cache
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Cobol, lisp, and python
Cobol, lisp, and pythonCobol, lisp, and python
Cobol, lisp, and python
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Optimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessorsOptimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessors
 
Abstraction file
Abstraction fileAbstraction file
Abstraction file
 
Object model
Object modelObject model
Object model
 
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
 
Abstract class
Abstract classAbstract class
Abstract class
 
Concurrency with java
Concurrency with javaConcurrency with java
Concurrency with java
 
Inheritance
InheritanceInheritance
Inheritance
 
Api crash
Api crashApi crash
Api crash
 

Recently uploaded

To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 

Recently uploaded (20)

To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 

Lisp

  • 1. TES3111 October 2001 Artificial Intelligence LISPLISP
  • 2. TES3111 October 2001 Lisp resources • We will use an implementation of LISP called Allegro Common LISP. • Different LISP interpreters include - Eg interpreter: Allegro LISP, Harlequin LISP, Corman Lisp. →Text books: ⇒ANSI Common LISP, P.Graham, Prentice Hall, 1995 (recommended) ⇒Common LISP:the language, G.L. Steele, Digital Press, 1990 (2nd Edition)
  • 3. TES3111 October 2001 Lisp resources-cont ⇒Common LISP: A gentle introduction to Symbolic Computing, David Touretzky, Addison Wesley, 1990. ⇒Paradigms of Artificial Intelligence Programming: Case Studies in Common LISP, Peter Norvig, Academic Press/Morgan Kaufmann, 1992.
  • 4. TES3111 October 2001 Useful websites for LISP • Allegro Lisp download – http://www.franz.com/downloads/ • Association of LISP users – http://www.alu.org • Common LISP Open Code Collection – http://clocc.sourceforge.net • AI special interest group of the ACM - – http://www.sigart.acm.org
  • 5. TES3111 October 2001 1. Lisp is interactive • There is an interpreter that evaluates inputs. An input is processes in 3 steps: 1. Reads input and construct expression from the input. 2. Evaluates the expression for meaning. 3. Prints the results of the evaluation, including signaling of erros if necessary. • These 3 steps can be customized by the programmer.
  • 6. TES3111 October 2001 2. Lisp is a dynamic language • Programs are developed incrementally, by making small changes to the source code. • Interpreter evaluates the changed definitions and then immediately run the results. • New definitions and data structures can be added at any time. • This features are ideal for prototyping.
  • 7. TES3111 October 2001 3. Lisp has symbols • Symbols are the basic type of data in use. • Symbols are used to build bigger, more complex expressions. • Example of symbols: – HELLO – 23-worldofsports
  • 8. TES3111 October 2001 4. LISP has lists • Lists are delimited using parenthesis (…). Anything can be placed in a list, including other lists (nested lists). For example: (1 orange 2 3) (once (upon a) time) • Empty list is represented as () • Caution: elements within a list are separated with a white space, and NOT a comma ,
  • 9. TES3111 October 2001 5. Lisp classifies data • It does not classify variables. • A variable is just a symbol. It can hold any type of value. • A variable do not have to be declared before it is used. • Lisp defines different types of data (rather than defining different types of variables)
  • 10. TES3111 October 2001 5. Lisp classifies data - contd Lisp Expression number symbol sequence integer float ratio keyword list vector string
  • 11. TES3111 October 2001 5. Lisp classifies data - contd • Integer - a counting number like 1, 2 ,3 …100, -23 • float - real number. Example 1.59, -100.3 • ratio - a fraction, example 99/23, 4/5 • symbol - a sequence of alphanumeric characters, eg: BOO, ID4… • keyword - a symbol prefixed with a colon. Eg- :BOO, :ID4 • list - a collection of zero or m ore expressions inside (..) • vector - 1 dimensional collection of expressions in sequential memory • string - a vector of 0 or more characters inside “ ”
  • 12. TES3111 October 2001 6. Lisp uses prefix notation • Operators appear in front of their operands. • The infix (10 + 3) is written as (+ 10 3)
  • 13. TES3111 October 2001 7. Lisp is functional • Lisp functions take data, operates on it, and return the results. The returned results are called function values. • Functions can return any number of values. • To call a function, place it as the first element of an input list, followed by its operands. Example: (+ 100 99 88) (setf x (+ 2 3)) • All operations are done through functions
  • 14. TES3111 October 2001 8. Programs and data • Lisp makes no distinction between programs and data. • A program can be treated as a set of instruction or as a list of symbols. • This makes it possible to write programs that generate another program, or programs that analyze other programs.
  • 15. TES3111 October 2001 9. Lisp evaluation is easy to understand • Rule 1 : If an expression is a constant, the interpreter will return the value of the constant. No more rules apply. Examples: ‘socrates, 4.5 • Rule 2: If Rule 1 is not applicable, and the expression is a symbol, then Lisp treats the symbol as a variable and no more rules are considered. If the variable has a value, Lisp will return that value. Otherwise it will report an error.
  • 16. TES3111 October 2001 9. Lisp evaluation is easy to understand • Rule 3: If Rule 1 and Rule 2 do not apply and the expression is a LIST, then Lisp treats it as a function call and no more rules are considered. – You should at this point remember that the first element in the list is assumed to be a defined a function. The remaining elements are data. Each expression in the data is evaluated left to right. • Rule 4: If Rules 1 to 3 do not apply, then there is an error!
  • 17. TES3111 October 2001 10. Lisp is easy to learn??? • How to study and program in Lisp? – Read the first few chapters of a good introductory Lisp book. – Read up the definition of each Lisp function that you encounter. – Start developing a good programming style from the very start!
  • 18. TES3111 October 2001 Data Structures S-Expression - Symbolic expression. It can be an Atom, a List or a collection of S- Expression enclosed by (…) Atom - String of characters beginning with a letter, digit. Eg: Artificial, intelligence, 31416..etc.
  • 19. TES3111 October 2001 Data Structures List - a collection of S-Expression enclosed by ( …. ). Eg: (One of these days) (one ((two) three) four)
  • 20. TES3111 October 2001 Basic Operations  A LISP program contains functions applied to its arguments.  Functions return LISP objects.  2 types of functions - PREDICATE and COMMANDS
  • 21. TES3111 October 2001 Predicate A function that tests for some condition involving its arguments and returns – Nil if the condition is FALSE (Nil stands for FALSE) – True for any other case. In LISP TRUE is represented using a special LISP variable T.
  • 22. TES3111 October 2001 Command • A command performs operations on its arguments and returns an S-expression. • Format of a command is: (<Command> Arg1 Arg2 … Argn) Note: All commands and predicates must be enclosed in (…). To differentiate from lists… a list is preceded with a single quote ‘ Eg : (CAR a b c) versus ‘(CAR a b c)
  • 23. TES3111 October 2001 Function - CAR CAR - returns the first element of a list. Examples: • (CAR ‘(a b c d e)) • (CAR ‘((an orange) a day)) • (CAR '(1 (2 3 (4 5)) 6)) • (CAR ‘()) Note that in the last example, the argument to CAR is a null- list.