SlideShare uma empresa 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]

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Semelhante 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
 

Semelhante 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
 

Mais 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
 

Mais 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

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
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 PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
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
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 

Último (20)

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
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 PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
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
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 

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