SlideShare una empresa de Scribd logo
1 de 13
Predicates in Lisp
 Predicates A predicate is a function used to test for some condition involving its arguments and returns nil if the condition is false, or some non-nil value if the condition is true. Name of the predicates in CL usually ends with p. Ex: numberp, standard-char-p etc.
overview Logical values Data Type predicates General Type Predicates Specific data type predicates Equality predicates Logical operators
Logical values The names nil and t are constants in Lisp This object represents logical false value and also the empty list. It can also be written as () The values of nil and t are not permitted to be changed. Data type predicates: using data type predicates one can determine     whether or not it belongs to a given type, or one      can compare two type specifies.
General Type predicates Syntax: typep object type Typep is the predicate that is true if the object is of type type false otherwise. Subtypep type1 type2 ,[object Object],Ex: (subtypep t t) returns T
Subtypep are supposed to return a second value of nil unless one or both of its arguments involves satisfies and, or, not or member. Subtypep should signal an error when one or both of its arguments involves values or the list form of the function type specifier Subtypep must always return the two values t and t in the case where its arguments, after expansion of specifies defined by deftype are equal. (subtypep ‘(array A) ‘ (array B)) is true if and only if (upgraded-array-element-type ‘A) is the same type as (upgraded-array-element-type ‘ b) (subtypep ‘ (complex A) ‘ (complex B)) is true if and only if (upgraded-complex-part-type ‘A) and (upgraded-complex-part-type ‘B) is of same type.
Specific data type predicates The following data types test for specific individual data types. null object returns true if the argument is () or false otherwise. symbolp object returns true if the argument is a symbol else returns false atom object is true if the argument is not cons otherwise its false. consp object is true if the argument is a cons, false otherwise listp objectis true if the argument is a cons or an empty list (), false otherwise Numberp object is T if the argument is any kind of number
Rationalp object is T if the argument is a rational number false otherwise Similarly we have floatp, charaterp, vectorp, stringp, complexp, simple-bit-vector-p, simple-string-vector-p, arrayp etc. packagep object is T if its argument is a package and otherwise is false functionp object is T if its arguments are suitable for applying to arguments, using for ex the funccall or apply function and otherwise is false Compiled-function-p object is T if its argument is any compiled code object and otherwise is false Commonp object is T if its argument is any standard CL data type, and otherwise is false
Equality predicates Cl provides these predicates to test for the equality of the two objects: eq, eql, equal, equalp  eq x y is true if and only if x and y are the same identical objects. Ex: (eq ‘g ‘h) false        (eq 3 3)true         (eq “hi” “HI”) false Eql x y is true if the arguments are eq, or of there are numbers of the same type with the same value, or if there are character objects that represent the same character
equal x yis true if the arguments are structurally similar objects. (isomorphic objects) Ex: (equal # #) true         (equal “FOO” “FOO”) true equalp x y is true if the two objects are equal, and if and only if they are eq that is, the same identical object.  two hash tables are considered the same by equalp if and only if they satisfy the following four conditions: ,[object Object]
They must have the same number of entries.
For every entry(key1, value1) in one hash table there must be the corresponding entry(key2, value2) in the other hash table.
For every entry(key1, value1) in one hash table and its corresponding entry(key2, value2) in the other , such that key1 and key2 are the same, equalp must be true of value1 and value2.,[object Object]

Más contenido relacionado

La actualidad más candente

Linear Search
Linear SearchLinear Search
Linear SearchSWATHIR72
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithmsHoang Nguyen
 
Type Conversion, Precedence and Associativity
Type Conversion, Precedence and AssociativityType Conversion, Precedence and Associativity
Type Conversion, Precedence and AssociativityAakash Singh
 
LR(1) and SLR(1) parsing
LR(1) and SLR(1) parsingLR(1) and SLR(1) parsing
LR(1) and SLR(1) parsingR Islam
 
Compiler Design LR parsing SLR ,LALR CLR
Compiler Design LR parsing SLR ,LALR CLRCompiler Design LR parsing SLR ,LALR CLR
Compiler Design LR parsing SLR ,LALR CLRRiazul Islam
 
Lecture 07 08 syntax analysis-4
Lecture 07 08 syntax analysis-4Lecture 07 08 syntax analysis-4
Lecture 07 08 syntax analysis-4Iffat Anjum
 
Type conversion, precedence, associativity in c programming
Type conversion, precedence, associativity in c programmingType conversion, precedence, associativity in c programming
Type conversion, precedence, associativity in c programmingDhrumil Panchal
 
Bottom - Up Parsing
Bottom - Up ParsingBottom - Up Parsing
Bottom - Up Parsingkunj desai
 
OPERATORS OF C++
OPERATORS OF C++OPERATORS OF C++
OPERATORS OF C++ANANT VYAS
 

La actualidad más candente (16)

07 top-down-parsing
07 top-down-parsing07 top-down-parsing
07 top-down-parsing
 
Linear Search
Linear SearchLinear Search
Linear Search
 
SEARCHING
SEARCHINGSEARCHING
SEARCHING
 
LL(1) parsing
LL(1) parsingLL(1) parsing
LL(1) parsing
 
Top down parsing
Top down parsingTop down parsing
Top down parsing
 
Python basic operators
Python   basic operatorsPython   basic operators
Python basic operators
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Type Conversion, Precedence and Associativity
Type Conversion, Precedence and AssociativityType Conversion, Precedence and Associativity
Type Conversion, Precedence and Associativity
 
LR(1) and SLR(1) parsing
LR(1) and SLR(1) parsingLR(1) and SLR(1) parsing
LR(1) and SLR(1) parsing
 
Compiler Design LR parsing SLR ,LALR CLR
Compiler Design LR parsing SLR ,LALR CLRCompiler Design LR parsing SLR ,LALR CLR
Compiler Design LR parsing SLR ,LALR CLR
 
Lecture 07 08 syntax analysis-4
Lecture 07 08 syntax analysis-4Lecture 07 08 syntax analysis-4
Lecture 07 08 syntax analysis-4
 
Type conversion, precedence, associativity in c programming
Type conversion, precedence, associativity in c programmingType conversion, precedence, associativity in c programming
Type conversion, precedence, associativity in c programming
 
Bottom - Up Parsing
Bottom - Up ParsingBottom - Up Parsing
Bottom - Up Parsing
 
Binary search
Binary searchBinary search
Binary search
 
OPERATORS OF C++
OPERATORS OF C++OPERATORS OF C++
OPERATORS OF C++
 
Lecture11 syntax analysis_7
Lecture11 syntax analysis_7Lecture11 syntax analysis_7
Lecture11 syntax analysis_7
 

Similar a LISP: Predicates in lisp

Data types and operators in vb
Data types and operators  in vbData types and operators  in vb
Data types and operators in vballdesign
 
data handling revision.pptx
data handling revision.pptxdata handling revision.pptx
data handling revision.pptxDeepaRavi21
 
LISP: Data types in lisp
LISP: Data types in lispLISP: Data types in lisp
LISP: Data types in lispLISP Content
 
Real World Haskell: Lecture 3
Real World Haskell: Lecture 3Real World Haskell: Lecture 3
Real World Haskell: Lecture 3Bryan O'Sullivan
 
Chapter3 basic java data types and declarations
Chapter3 basic java data types and declarationsChapter3 basic java data types and declarations
Chapter3 basic java data types and declarationssshhzap
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithmsLuis Goldster
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithmsTony Nguyen
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithmsFraboni Ec
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithmsJames Wong
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithmsYoung Alista
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithmsHarry Potter
 
best first-sort
best first-sortbest first-sort
best first-sortRajendran
 
Linear Data Structures_SSD.pdf
Linear Data Structures_SSD.pdfLinear Data Structures_SSD.pdf
Linear Data Structures_SSD.pdfssuser37b0e0
 

Similar a LISP: Predicates in lisp (20)

Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11
 
Matlab practical ---4.pdf
Matlab practical ---4.pdfMatlab practical ---4.pdf
Matlab practical ---4.pdf
 
Probability distributions
Probability distributions  Probability distributions
Probability distributions
 
Dicrete structure
Dicrete structureDicrete structure
Dicrete structure
 
Data types and operators in vb
Data types and operators  in vbData types and operators  in vb
Data types and operators in vb
 
data handling revision.pptx
data handling revision.pptxdata handling revision.pptx
data handling revision.pptx
 
LISP: Data types in lisp
LISP: Data types in lispLISP: Data types in lisp
LISP: Data types in lisp
 
Data types in python part 2
Data types in python part 2Data types in python part 2
Data types in python part 2
 
Real World Haskell: Lecture 3
Real World Haskell: Lecture 3Real World Haskell: Lecture 3
Real World Haskell: Lecture 3
 
Chapter3 basic java data types and declarations
Chapter3 basic java data types and declarationsChapter3 basic java data types and declarations
Chapter3 basic java data types and declarations
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
best first-sort
best first-sortbest first-sort
best first-sort
 
Pythonintro
PythonintroPythonintro
Pythonintro
 
PRESENTATION.pptx
PRESENTATION.pptxPRESENTATION.pptx
PRESENTATION.pptx
 
Linear Data Structures_SSD.pdf
Linear Data Structures_SSD.pdfLinear Data Structures_SSD.pdf
Linear Data Structures_SSD.pdf
 

Más de LISP Content

LISP: Control Structures In Lisp
LISP: Control Structures In LispLISP: Control Structures In Lisp
LISP: Control Structures In LispLISP Content
 
LISP:Declarations In Lisp
LISP:Declarations In LispLISP:Declarations In Lisp
LISP:Declarations In LispLISP Content
 
LISP: Errors In Lisp
LISP: Errors In LispLISP: Errors In Lisp
LISP: Errors In LispLISP Content
 
LISP: Input And Output
LISP: Input And OutputLISP: Input And Output
LISP: Input And OutputLISP Content
 
LISP: Object Sytstem Lisp
LISP: Object Sytstem LispLISP: Object Sytstem Lisp
LISP: Object Sytstem LispLISP Content
 
LISP: Loops In Lisp
LISP: Loops In LispLISP: Loops In Lisp
LISP: Loops In LispLISP Content
 
LISP: Type specifiers in lisp
LISP: Type specifiers in lispLISP: Type specifiers in lisp
LISP: Type specifiers in lispLISP Content
 
LISP: Symbols and packages in lisp
LISP: Symbols and packages in lispLISP: Symbols and packages in lisp
LISP: Symbols and packages in lispLISP Content
 
LISP: Scope and extent in lisp
LISP: Scope and extent in lispLISP: Scope and extent in lisp
LISP: Scope and extent in lispLISP Content
 
LISP: Program structure in lisp
LISP: Program structure in lispLISP: Program structure in lisp
LISP: Program structure in lispLISP Content
 
LISP: Macros in lisp
LISP: Macros in lispLISP: Macros in lisp
LISP: Macros in lispLISP Content
 
LISP: Introduction To Lisp
LISP: Introduction To LispLISP: Introduction To Lisp
LISP: Introduction To LispLISP Content
 

Más de LISP Content (12)

LISP: Control Structures In Lisp
LISP: Control Structures In LispLISP: Control Structures In Lisp
LISP: Control Structures In Lisp
 
LISP:Declarations In Lisp
LISP:Declarations In LispLISP:Declarations In Lisp
LISP:Declarations In Lisp
 
LISP: Errors In Lisp
LISP: Errors In LispLISP: Errors In Lisp
LISP: Errors In Lisp
 
LISP: Input And Output
LISP: Input And OutputLISP: Input And Output
LISP: Input And Output
 
LISP: Object Sytstem Lisp
LISP: Object Sytstem LispLISP: Object Sytstem Lisp
LISP: Object Sytstem Lisp
 
LISP: Loops In Lisp
LISP: Loops In LispLISP: Loops In Lisp
LISP: Loops In Lisp
 
LISP: Type specifiers in lisp
LISP: Type specifiers in lispLISP: Type specifiers in lisp
LISP: Type specifiers in lisp
 
LISP: Symbols and packages in lisp
LISP: Symbols and packages in lispLISP: Symbols and packages in lisp
LISP: Symbols and packages in lisp
 
LISP: Scope and extent in lisp
LISP: Scope and extent in lispLISP: Scope and extent in lisp
LISP: Scope and extent in lisp
 
LISP: Program structure in lisp
LISP: Program structure in lispLISP: Program structure in lisp
LISP: Program structure in lisp
 
LISP: Macros in lisp
LISP: Macros in lispLISP: Macros in lisp
LISP: Macros in lisp
 
LISP: Introduction To Lisp
LISP: Introduction To LispLISP: Introduction To Lisp
LISP: Introduction To Lisp
 

Último

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 

Último (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

LISP: Predicates in lisp

  • 2. Predicates A predicate is a function used to test for some condition involving its arguments and returns nil if the condition is false, or some non-nil value if the condition is true. Name of the predicates in CL usually ends with p. Ex: numberp, standard-char-p etc.
  • 3. overview Logical values Data Type predicates General Type Predicates Specific data type predicates Equality predicates Logical operators
  • 4. Logical values The names nil and t are constants in Lisp This object represents logical false value and also the empty list. It can also be written as () The values of nil and t are not permitted to be changed. Data type predicates: using data type predicates one can determine whether or not it belongs to a given type, or one can compare two type specifies.
  • 5.
  • 6. Subtypep are supposed to return a second value of nil unless one or both of its arguments involves satisfies and, or, not or member. Subtypep should signal an error when one or both of its arguments involves values or the list form of the function type specifier Subtypep must always return the two values t and t in the case where its arguments, after expansion of specifies defined by deftype are equal. (subtypep ‘(array A) ‘ (array B)) is true if and only if (upgraded-array-element-type ‘A) is the same type as (upgraded-array-element-type ‘ b) (subtypep ‘ (complex A) ‘ (complex B)) is true if and only if (upgraded-complex-part-type ‘A) and (upgraded-complex-part-type ‘B) is of same type.
  • 7. Specific data type predicates The following data types test for specific individual data types. null object returns true if the argument is () or false otherwise. symbolp object returns true if the argument is a symbol else returns false atom object is true if the argument is not cons otherwise its false. consp object is true if the argument is a cons, false otherwise listp objectis true if the argument is a cons or an empty list (), false otherwise Numberp object is T if the argument is any kind of number
  • 8. Rationalp object is T if the argument is a rational number false otherwise Similarly we have floatp, charaterp, vectorp, stringp, complexp, simple-bit-vector-p, simple-string-vector-p, arrayp etc. packagep object is T if its argument is a package and otherwise is false functionp object is T if its arguments are suitable for applying to arguments, using for ex the funccall or apply function and otherwise is false Compiled-function-p object is T if its argument is any compiled code object and otherwise is false Commonp object is T if its argument is any standard CL data type, and otherwise is false
  • 9. Equality predicates Cl provides these predicates to test for the equality of the two objects: eq, eql, equal, equalp eq x y is true if and only if x and y are the same identical objects. Ex: (eq ‘g ‘h) false (eq 3 3)true (eq “hi” “HI”) false Eql x y is true if the arguments are eq, or of there are numbers of the same type with the same value, or if there are character objects that represent the same character
  • 10.
  • 11. They must have the same number of entries.
  • 12. For every entry(key1, value1) in one hash table there must be the corresponding entry(key2, value2) in the other hash table.
  • 13.
  • 14.
  • 15. Visit more self help tutorials Pick a tutorial of your choice and browse through it at your own pace. The tutorials section is free, self-guiding and will not involve any additional support. Visit us at www.dataminingtools.net