SlideShare a Scribd company logo
1 of 35
PRESENTATION OF
ARTIFICIAL
INTELLIGENCE
TOPIC TO BE DISCUSSED
An INTRODUCTION OF LISP ?
FEATUERS OF LISP
TEXT EDITOR
LISP EXECUTOR
LISP – BASIC SYNTAX
LISP-DATA TYPES
LISP CONSTANT
LISP VARIABLES
LISP OPERATOR
DECISION MAKING
LISP ARRAY
LISP LOOP
AN INTRODUCTION OF LISP ?
•Lisp – List Processing language
• John McCarthy invented LISP in 1958, shortly after the development of
FORTRAN. It was first implement by Steve Russell on an IBM 704 computer
• It is one of the most popular language for Artificial Intelligence programs
• FEATURES OF LISP:
• It is machine-independent
• It allows updating the programs dynamically.
• It provides high level debugging.
FEATUERS OF LISP
• It provides wide-ranging data types like, objects, structures, lists, vectors, adjustable
arrays, hash-tables, and symbols.
• It provides an object-oriented condition system.
• It provides complete I/O library.
• It provides extensive control structures.
• Lisp was originally created as a practical mathematical notation for computer programs
USES OF COMMON LISP
USES OF CL
• CL is a very successful language in that
it is extremely powerful as an AI tool
those that use it love it
• And yet CL is a very uncommon language because
it is very complicated
most software development is in C++ (with some in Java, C#, C, Python, Ada, etc)
such that few programmers would choose to use CL for development
• The most important software developed from CL includes:
– Emacs
– G2 (a real-time expert system)
– AutoCAD
– Igor Engraver (musical notation editor and publisher)
– Yahoo Store
TEXT EDITOR
• This will be used to type your program. Examples of few editors include Windows
Notepad, OS Edit command, Brief, Epsilon, EMACS, and vim or vi.
• Name and version of text editor can vary on different operating systems. For example,
Notepad will be used on Windows, and vim or vi can be used on windows as well as
Linux or UNIX.
• The files you create with your editor are called source files and contain program source
code. The source files for Lisp programs are typically named with the extension ".lisp".
• Before starting your programming, make sure you have one text editor in place and
you have enough experience to write a computer program, save it in a file, finally
execute it.
TEXT EDITOR
• The source code written in source file is the human readable source for your program.
It needs to be "executed", to turn into machine language so that your CPU can actually
execute the program as per instructions given.
• This Lisp programming language will be used to execute your source code into final
executable program. I assume you have basic knowledge about a programming
language.
• CLISP is the GNU Common LISP multi-architechtural compiler used for setting up
LISP in Windows.
LISP EXECUTOR
LISP - BASIC SYNTAX
LISP programs are made up of three basic building blocks:
• atom
• list
• string
ATOM:
An atom is a number or string of contiguous characters. It includes numbers and special
characters.
LISP BASIC SYNTAX
EXAMPLE:
Name
2343333
*HELLO*
3333309
abc123
DEFINE LIST
LIST
A list is a sequence of atoms and/or other lists enclosed in parentheses
EXAMPLE
(I AM A GENIOUS GIRL)
(I AM A LIST)
(A(A B C)D )
DEFINE STRING
STRING
A string is a group of characters enclosed in double quotation marks
EXAMPLE
“I AM A STRING”
“ HELLO WORLD”
“PLEASE ENTER THE FOLLOWING DETAILS”
ADDING COMMENTS
COMMENTS
The semicolon symbol (;) is used for indicating a comment line
EXAMPLES
“I AM A STRING”
; HELLO WORLD
“PLEASE ENTER THE FOLLOWING DETAILS”
CONCEPTS ABOUT LISP
Following are some of the important points to note
The basic numeric operations in LISP are +, -, *, and /
LISP expressions are case-insensitive
Naming Conventions in LISP
• Name or symbols can consist of any number of alphanumeric characters other than
whitespace, open and closing parentheses, double and single quotes, backslash, comma,
colon, semicolon and vertical bar. To use these characters in a name, you need to use
escape character ().
• A name can have digits but not entirely made of digits, because then it would be read as a
number. Similarly a name can have periods, but can't be made entirely of periods.
LISP DATA TYPES
LISP data types can be categorized as
• Scalar types - for example, number types, characters, symbols etc.
• Data structures - for example, lists, vectors, bit-vectors, and strings.
LISP VARIABLES
Global Variables
• Global variables have permanent values throughout the LISP system and remain in
effect until a new value is specified.
• Global variables are generally declared using the defvar construct.
Example
(Defvar X 234)
(Write x)
output: (234)
• Since there is no type declaration for variables in LISP, you directly specify a value
for a symbol with the setq construct
• Example
(set q x 10 )
(format t "x = ~2d ~%" x )
• The above expression assigns the value 10 to the variable x
output: (x = 10)
LISP VARIABLE
LOCAL VARIABLE
• Local variables are defined within a given procedure. The parameters named as
arguments within a function definition are also local variables. Local variables are
accessible only within the respective function.
• Like the global variables, local variables can also be created using the setqconstruct.
• There are two other constructs - let and prog for creating local variables.
EXAMPLE:
 (let ( (x’ a) (y ’b) (z’ c)))
Output: x = A y = B z = C
 (prog ((x '(a b c))(y '(1 2 3))(z '(p q 10)))
Output : x = (A B C) y = (1 2 3) z = (P Q 10)
LISP CONSTANT
CONSTANT
In LISP, constants are variables that never change their values during program
execution.
Constants are declared using the defconstant construct.
EXAMPLE
PI value is 3.14
Value cannot be changed
LISP OPERATOR
OPERATOR
An operator is a symbol that tells the compiler to perform specific mathematical or logical
manipulations.
The operations allowed on data could be categorized as:
• Arithmetic Operations
• Comparison Operations
• Logical Operations
• Bitwise Operations
LISP OPERATOR
ARITHMETIC OPERATORS
IF VARIABLE A HOLDS 10 AND VARIABLE B HOLDS 20
DESCRIPTION EXAMPLE
+ Adds two operands (+AB) will give 30
- Subtracts second operand from the first (- A B) will give -10
* Multiplies both operands
(* A B) will give 200
LISP OPERATOR
OPERATOR DESCRIPTION EXAMPLE
/
Divides numerator by de-numerator
(/ B A) will give 2
Mod,rem Modulus Operator and remainder of after an
integer division
(mod B A )will give
0
incf Increments operator increases integer value
by the second argument specified
(incf A 3) will give
13
decf Decrements operator decreases integer
value by the second argument specified
(decf A 4) will give 9
COMPARISON OPERATOR
OPERATO
R
DESCRIPTION EXAMPLE
= Checks if the values of the operands are
all equal or not, if yes then condition
becomes true.
(= A B) is not true.
/= Checks if the values of the operands are
all different or not, if values are not equal
then condition becomes true.
(/= A B) is true.
Assume variable A holds 10 and variable B holds
20, then:
COMPARISON OPERATOR
> Checks if the values of the operands are monotonically decreasing. (> A B) is not true.
< Checks if the values of the operands are monotonically increasing. (< A B) is true.
>= Checks if the value of any left operand is greater than or equal to the
value of next right operand, if yes then condition becomes true.
(>= A B) is not true.
COMPARISON OPERATOR
<= Checks if the value of any left operand is less than
or equal to the value of its right operand, if yes then
condition becomes true.
(<= A B) is true.
max It compares two or more arguments and returns
the maximum value.
(max A B) returns 20
min It compares two or more arguments and returns
the minimum value.
(min A B) returns 20
LOGICAL OPERATION ON BOOLEAN
VALUES
Common LISP provides three logical operators: and, or, and not that operates on
Boolean values. Assume A has value nil and B has value 5, then:
OPETATOR DESCRIPTION
EXAMPLE
and It takes any number of arguments. The arguments are
evaluated left to right. If all arguments evaluate to non-nil, then
the value of the last argument is returned. Otherwise nil is
returned.
(and A B) will
return NIL.
or It takes any number of arguments. The arguments are
evaluated left to right until one evaluates to non-nil, in such
case the argument value is returned, otherwise it returns nil
(or A B) will
return 5
not It takes one argument and returns t if the
argument evaluates to nil.
(not A) will
return T.
BITWISE OPERATIONS ON NUMBERS
• Bitwise operators work on bits and perform bit-by-bit operation. The truth tables for
bitwise and, or, and xor operations are as follows
p q P and q P or q P xor q
0 0 0 0 0
0 1 0 1 1
1 1 1 1 0
1 0 0 1 1
DECISION MAKING
• Decision making structures require that the programmer specify one or
more conditions to be evaluated or tested by the program, along with a
statement or statements to be executed if the condition is determined to be
true, and optionally, other statements to be executed if the condition is
determined to be false.
EXAMPLE
IF-ELSE STRUCTURE
DECISION MAKING
IF-ELSE STRUCTURE:
LISP LOOP
• There may be a situation, when you need to execute a block of code numbers of times.
A loop statement allows us to execute a statement or group of statements multiple
times and following is the general form of a loop statement in most of the programming
languages.
• LISP provides the following types of constructs to handle looping requirements.
LISP LOOP
LISP LOOP
CONSTRUC
T
DESCRIPTION
loop The loop construct is the simplest form of iteration provided by LISP. In its simplest form, it
allows you to execute some statement(s) repeatedly until it finds a return statement.
Loop for The loop for construct allows you to implement a for-loop like iteration as most common in
other languages.
do The do construct is also used for performing iteration using LISP. It provides a structured
form of iteration.
dotimes The dotimes construct allows looping for some fixed number of
iterations.
dolist The dolist construct allows iteration through each element of a list.
LISP ARRAY
• LISP allows you to define single or multiple-dimension arrays using the make-
array function. An array can store any LISP object as its elements.
• All arrays consist of contiguous memory locations. The lowest address corresponds to
the first element and the highest address to the last element.
• In LISP, an array element is specified by a sequence of non-negative integer
• indices. The length of the sequence must equal the rank of the array. Indexing starts
from zero.
• The number of dimensions of an array is called its rank.
LISP ARRAY
HOW TO DECLARE AN ARRAY
• For example, to create an array with 10- cells, named my-array, we can write:
• (setf my-array(make array(10)))
• The aref function allows accessing the contents of the cells. It takes two arguments, the
name of the array and the index value.
• For example, to access the content of the tenth cell, we write:
(aref my-array 9)

More Related Content

What's hot

Lecture 26 local beam search
Lecture 26 local beam searchLecture 26 local beam search
Lecture 26 local beam searchHema Kashyap
 
Thread scheduling in Operating Systems
Thread scheduling in Operating SystemsThread scheduling in Operating Systems
Thread scheduling in Operating SystemsNitish Gulati
 
Introduction TO Finite Automata
Introduction TO Finite AutomataIntroduction TO Finite Automata
Introduction TO Finite AutomataRatnakar Mikkili
 
Finite State Machine.ppt.pptx
Finite State Machine.ppt.pptxFinite State Machine.ppt.pptx
Finite State Machine.ppt.pptxSKUP1
 
Unit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - ThreadsUnit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - Threadscscarcas
 
Parsing (Automata)
Parsing (Automata)Parsing (Automata)
Parsing (Automata)ROOP SAGAR
 
ProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) IntroductionProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) Introductionwahab khan
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture NotesFellowBuddy.com
 
Introduction to Programming in LISP
Introduction to Programming in LISPIntroduction to Programming in LISP
Introduction to Programming in LISPKnoldus Inc.
 
Deterministic context free grammars &non-deterministic
Deterministic context free grammars &non-deterministicDeterministic context free grammars &non-deterministic
Deterministic context free grammars &non-deterministicLeyo Stephen
 
State space search and Problem Solving techniques
State space search and Problem Solving techniquesState space search and Problem Solving techniques
State space search and Problem Solving techniquesKirti Verma
 

What's hot (20)

Parsing
ParsingParsing
Parsing
 
Open mp
Open mpOpen mp
Open mp
 
Lecture 26 local beam search
Lecture 26 local beam searchLecture 26 local beam search
Lecture 26 local beam search
 
Thread scheduling in Operating Systems
Thread scheduling in Operating SystemsThread scheduling in Operating Systems
Thread scheduling in Operating Systems
 
Introduction TO Finite Automata
Introduction TO Finite AutomataIntroduction TO Finite Automata
Introduction TO Finite Automata
 
LR Parsing
LR ParsingLR Parsing
LR Parsing
 
Finite State Machine.ppt.pptx
Finite State Machine.ppt.pptxFinite State Machine.ppt.pptx
Finite State Machine.ppt.pptx
 
Unit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - ThreadsUnit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - Threads
 
Parsing (Automata)
Parsing (Automata)Parsing (Automata)
Parsing (Automata)
 
ProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) IntroductionProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) Introduction
 
Turing machine
Turing machineTuring machine
Turing machine
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture Notes
 
COMPILER DESIGN- Syntax Directed Translation
COMPILER DESIGN- Syntax Directed TranslationCOMPILER DESIGN- Syntax Directed Translation
COMPILER DESIGN- Syntax Directed Translation
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 
Introduction to Programming in LISP
Introduction to Programming in LISPIntroduction to Programming in LISP
Introduction to Programming in LISP
 
Lecture: Automata
Lecture: AutomataLecture: Automata
Lecture: Automata
 
Deterministic context free grammars &non-deterministic
Deterministic context free grammars &non-deterministicDeterministic context free grammars &non-deterministic
Deterministic context free grammars &non-deterministic
 
4.6 halting problem
4.6 halting problem4.6 halting problem
4.6 halting problem
 
State space search and Problem Solving techniques
State space search and Problem Solving techniquesState space search and Problem Solving techniques
State space search and Problem Solving techniques
 

Similar 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
 
Lisp, An Introduction.ppt
Lisp, An Introduction.pptLisp, An Introduction.ppt
Lisp, An Introduction.pptLuis Soza
 
modul-python-all.pptx
modul-python-all.pptxmodul-python-all.pptx
modul-python-all.pptxYusuf Ayuba
 
002. Introducere in type script
002. Introducere in type script002. Introducere in type script
002. Introducere in type scriptDmitrii Stoian
 
Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Rasan Samarasinghe
 
Parquet - Data I/O - Philadelphia 2013
Parquet - Data I/O - Philadelphia 2013Parquet - Data I/O - Philadelphia 2013
Parquet - Data I/O - Philadelphia 2013larsgeorge
 
Unit1 111206003944-phpapp02
Unit1 111206003944-phpapp02Unit1 111206003944-phpapp02
Unit1 111206003944-phpapp02riddhi viradiya
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptxMark82418
 
Q-Step_WS_02102019_Practical_introduction_to_Python.pptx
Q-Step_WS_02102019_Practical_introduction_to_Python.pptxQ-Step_WS_02102019_Practical_introduction_to_Python.pptx
Q-Step_WS_02102019_Practical_introduction_to_Python.pptxnyomans1
 
Q-SPractical_introduction_to_Python.pptx
Q-SPractical_introduction_to_Python.pptxQ-SPractical_introduction_to_Python.pptx
Q-SPractical_introduction_to_Python.pptxJeromeTacata3
 
Basics Of C Programming For Beginners In Easiest Way
Basics Of C Programming For Beginners In Easiest WayBasics Of C Programming For Beginners In Easiest Way
Basics Of C Programming For Beginners In Easiest Wayakshay rajpure
 
Basic C Programming language
Basic C Programming languageBasic C Programming language
Basic C Programming languageAbhishek Soni
 
Introduction to Compiler Construction
Introduction to Compiler Construction Introduction to Compiler Construction
Introduction to Compiler Construction Sarmad Ali
 
C programming language
C programming languageC programming language
C programming languageAbin Rimal
 

Similar to Lisp (20)

Lecture 2 lisp-Overview
Lecture 2 lisp-OverviewLecture 2 lisp-Overview
Lecture 2 lisp-Overview
 
AI UNIT-4 Final (2).pptx
AI UNIT-4 Final (2).pptxAI UNIT-4 Final (2).pptx
AI UNIT-4 Final (2).pptx
 
Mbd dd
Mbd ddMbd dd
Mbd dd
 
intro.ppt
intro.pptintro.ppt
intro.ppt
 
intro.ppt
intro.pptintro.ppt
intro.ppt
 
Lisp, An Introduction.ppt
Lisp, An Introduction.pptLisp, An Introduction.ppt
Lisp, An Introduction.ppt
 
Lisp and scheme i
Lisp and scheme iLisp and scheme i
Lisp and scheme i
 
modul-python-all.pptx
modul-python-all.pptxmodul-python-all.pptx
modul-python-all.pptx
 
LISP.ppt
LISP.pptLISP.ppt
LISP.ppt
 
002. Introducere in type script
002. Introducere in type script002. Introducere in type script
002. Introducere in type script
 
Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++
 
Parquet - Data I/O - Philadelphia 2013
Parquet - Data I/O - Philadelphia 2013Parquet - Data I/O - Philadelphia 2013
Parquet - Data I/O - Philadelphia 2013
 
Unit1 111206003944-phpapp02
Unit1 111206003944-phpapp02Unit1 111206003944-phpapp02
Unit1 111206003944-phpapp02
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
 
Q-Step_WS_02102019_Practical_introduction_to_Python.pptx
Q-Step_WS_02102019_Practical_introduction_to_Python.pptxQ-Step_WS_02102019_Practical_introduction_to_Python.pptx
Q-Step_WS_02102019_Practical_introduction_to_Python.pptx
 
Q-SPractical_introduction_to_Python.pptx
Q-SPractical_introduction_to_Python.pptxQ-SPractical_introduction_to_Python.pptx
Q-SPractical_introduction_to_Python.pptx
 
Basics Of C Programming For Beginners In Easiest Way
Basics Of C Programming For Beginners In Easiest WayBasics Of C Programming For Beginners In Easiest Way
Basics Of C Programming For Beginners In Easiest Way
 
Basic C Programming language
Basic C Programming languageBasic C Programming language
Basic C Programming language
 
Introduction to Compiler Construction
Introduction to Compiler Construction Introduction to Compiler Construction
Introduction to Compiler Construction
 
C programming language
C programming languageC programming language
C programming language
 

Recently uploaded

APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
"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
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Recently uploaded (20)

APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
"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...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

Lisp

  • 2. TOPIC TO BE DISCUSSED An INTRODUCTION OF LISP ? FEATUERS OF LISP TEXT EDITOR LISP EXECUTOR LISP – BASIC SYNTAX LISP-DATA TYPES LISP CONSTANT LISP VARIABLES LISP OPERATOR DECISION MAKING LISP ARRAY LISP LOOP
  • 3. AN INTRODUCTION OF LISP ? •Lisp – List Processing language • John McCarthy invented LISP in 1958, shortly after the development of FORTRAN. It was first implement by Steve Russell on an IBM 704 computer • It is one of the most popular language for Artificial Intelligence programs • FEATURES OF LISP: • It is machine-independent • It allows updating the programs dynamically. • It provides high level debugging.
  • 4.
  • 5. FEATUERS OF LISP • It provides wide-ranging data types like, objects, structures, lists, vectors, adjustable arrays, hash-tables, and symbols. • It provides an object-oriented condition system. • It provides complete I/O library. • It provides extensive control structures. • Lisp was originally created as a practical mathematical notation for computer programs
  • 6. USES OF COMMON LISP USES OF CL • CL is a very successful language in that it is extremely powerful as an AI tool those that use it love it • And yet CL is a very uncommon language because it is very complicated most software development is in C++ (with some in Java, C#, C, Python, Ada, etc) such that few programmers would choose to use CL for development • The most important software developed from CL includes: – Emacs – G2 (a real-time expert system) – AutoCAD – Igor Engraver (musical notation editor and publisher) – Yahoo Store
  • 7. TEXT EDITOR • This will be used to type your program. Examples of few editors include Windows Notepad, OS Edit command, Brief, Epsilon, EMACS, and vim or vi. • Name and version of text editor can vary on different operating systems. For example, Notepad will be used on Windows, and vim or vi can be used on windows as well as Linux or UNIX. • The files you create with your editor are called source files and contain program source code. The source files for Lisp programs are typically named with the extension ".lisp". • Before starting your programming, make sure you have one text editor in place and you have enough experience to write a computer program, save it in a file, finally execute it.
  • 8. TEXT EDITOR • The source code written in source file is the human readable source for your program. It needs to be "executed", to turn into machine language so that your CPU can actually execute the program as per instructions given. • This Lisp programming language will be used to execute your source code into final executable program. I assume you have basic knowledge about a programming language. • CLISP is the GNU Common LISP multi-architechtural compiler used for setting up LISP in Windows.
  • 10. LISP - BASIC SYNTAX LISP programs are made up of three basic building blocks: • atom • list • string ATOM: An atom is a number or string of contiguous characters. It includes numbers and special characters.
  • 12. DEFINE LIST LIST A list is a sequence of atoms and/or other lists enclosed in parentheses EXAMPLE (I AM A GENIOUS GIRL) (I AM A LIST) (A(A B C)D )
  • 13. DEFINE STRING STRING A string is a group of characters enclosed in double quotation marks EXAMPLE “I AM A STRING” “ HELLO WORLD” “PLEASE ENTER THE FOLLOWING DETAILS”
  • 14. ADDING COMMENTS COMMENTS The semicolon symbol (;) is used for indicating a comment line EXAMPLES “I AM A STRING” ; HELLO WORLD “PLEASE ENTER THE FOLLOWING DETAILS”
  • 15. CONCEPTS ABOUT LISP Following are some of the important points to note The basic numeric operations in LISP are +, -, *, and / LISP expressions are case-insensitive Naming Conventions in LISP • Name or symbols can consist of any number of alphanumeric characters other than whitespace, open and closing parentheses, double and single quotes, backslash, comma, colon, semicolon and vertical bar. To use these characters in a name, you need to use escape character (). • A name can have digits but not entirely made of digits, because then it would be read as a number. Similarly a name can have periods, but can't be made entirely of periods.
  • 16. LISP DATA TYPES LISP data types can be categorized as • Scalar types - for example, number types, characters, symbols etc. • Data structures - for example, lists, vectors, bit-vectors, and strings.
  • 17. LISP VARIABLES Global Variables • Global variables have permanent values throughout the LISP system and remain in effect until a new value is specified. • Global variables are generally declared using the defvar construct. Example (Defvar X 234) (Write x) output: (234) • Since there is no type declaration for variables in LISP, you directly specify a value for a symbol with the setq construct • Example (set q x 10 ) (format t "x = ~2d ~%" x ) • The above expression assigns the value 10 to the variable x output: (x = 10)
  • 18. LISP VARIABLE LOCAL VARIABLE • Local variables are defined within a given procedure. The parameters named as arguments within a function definition are also local variables. Local variables are accessible only within the respective function. • Like the global variables, local variables can also be created using the setqconstruct. • There are two other constructs - let and prog for creating local variables. EXAMPLE:  (let ( (x’ a) (y ’b) (z’ c))) Output: x = A y = B z = C  (prog ((x '(a b c))(y '(1 2 3))(z '(p q 10))) Output : x = (A B C) y = (1 2 3) z = (P Q 10)
  • 19. LISP CONSTANT CONSTANT In LISP, constants are variables that never change their values during program execution. Constants are declared using the defconstant construct. EXAMPLE PI value is 3.14 Value cannot be changed
  • 20. LISP OPERATOR OPERATOR An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. The operations allowed on data could be categorized as: • Arithmetic Operations • Comparison Operations • Logical Operations • Bitwise Operations
  • 21. LISP OPERATOR ARITHMETIC OPERATORS IF VARIABLE A HOLDS 10 AND VARIABLE B HOLDS 20 DESCRIPTION EXAMPLE + Adds two operands (+AB) will give 30 - Subtracts second operand from the first (- A B) will give -10 * Multiplies both operands (* A B) will give 200
  • 22. LISP OPERATOR OPERATOR DESCRIPTION EXAMPLE / Divides numerator by de-numerator (/ B A) will give 2 Mod,rem Modulus Operator and remainder of after an integer division (mod B A )will give 0 incf Increments operator increases integer value by the second argument specified (incf A 3) will give 13 decf Decrements operator decreases integer value by the second argument specified (decf A 4) will give 9
  • 23. COMPARISON OPERATOR OPERATO R DESCRIPTION EXAMPLE = Checks if the values of the operands are all equal or not, if yes then condition becomes true. (= A B) is not true. /= Checks if the values of the operands are all different or not, if values are not equal then condition becomes true. (/= A B) is true. Assume variable A holds 10 and variable B holds 20, then:
  • 24. COMPARISON OPERATOR > Checks if the values of the operands are monotonically decreasing. (> A B) is not true. < Checks if the values of the operands are monotonically increasing. (< A B) is true. >= Checks if the value of any left operand is greater than or equal to the value of next right operand, if yes then condition becomes true. (>= A B) is not true.
  • 25. COMPARISON OPERATOR <= Checks if the value of any left operand is less than or equal to the value of its right operand, if yes then condition becomes true. (<= A B) is true. max It compares two or more arguments and returns the maximum value. (max A B) returns 20 min It compares two or more arguments and returns the minimum value. (min A B) returns 20
  • 26. LOGICAL OPERATION ON BOOLEAN VALUES Common LISP provides three logical operators: and, or, and not that operates on Boolean values. Assume A has value nil and B has value 5, then: OPETATOR DESCRIPTION EXAMPLE and It takes any number of arguments. The arguments are evaluated left to right. If all arguments evaluate to non-nil, then the value of the last argument is returned. Otherwise nil is returned. (and A B) will return NIL. or It takes any number of arguments. The arguments are evaluated left to right until one evaluates to non-nil, in such case the argument value is returned, otherwise it returns nil (or A B) will return 5 not It takes one argument and returns t if the argument evaluates to nil. (not A) will return T.
  • 27. BITWISE OPERATIONS ON NUMBERS • Bitwise operators work on bits and perform bit-by-bit operation. The truth tables for bitwise and, or, and xor operations are as follows p q P and q P or q P xor q 0 0 0 0 0 0 1 0 1 1 1 1 1 1 0 1 0 0 1 1
  • 28. DECISION MAKING • Decision making structures require that the programmer specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false. EXAMPLE IF-ELSE STRUCTURE
  • 30. LISP LOOP • There may be a situation, when you need to execute a block of code numbers of times. A loop statement allows us to execute a statement or group of statements multiple times and following is the general form of a loop statement in most of the programming languages. • LISP provides the following types of constructs to handle looping requirements.
  • 32. LISP LOOP CONSTRUC T DESCRIPTION loop The loop construct is the simplest form of iteration provided by LISP. In its simplest form, it allows you to execute some statement(s) repeatedly until it finds a return statement. Loop for The loop for construct allows you to implement a for-loop like iteration as most common in other languages. do The do construct is also used for performing iteration using LISP. It provides a structured form of iteration. dotimes The dotimes construct allows looping for some fixed number of iterations. dolist The dolist construct allows iteration through each element of a list.
  • 33. LISP ARRAY • LISP allows you to define single or multiple-dimension arrays using the make- array function. An array can store any LISP object as its elements. • All arrays consist of contiguous memory locations. The lowest address corresponds to the first element and the highest address to the last element. • In LISP, an array element is specified by a sequence of non-negative integer • indices. The length of the sequence must equal the rank of the array. Indexing starts from zero. • The number of dimensions of an array is called its rank.
  • 35. HOW TO DECLARE AN ARRAY • For example, to create an array with 10- cells, named my-array, we can write: • (setf my-array(make array(10))) • The aref function allows accessing the contents of the cells. It takes two arguments, the name of the array and the index value. • For example, to access the content of the tenth cell, we write: (aref my-array 9)

Editor's Notes

  1. Refers to a software application that runs only on a particular type of computer. Programs that run on a variety of different types of computers are called machine independent.