SlideShare a Scribd company logo
Data Types in Lisp
OverviewNumbersCharactersSymbolsLists and consesArraysHash tablesFunctionsData structures
In Lisp, data type is possibly a set of lisp objects.The set of all objects is defined by the symbol t.The empty data type which contains no data objects, is defined by nil.A type called common encompasses all the data objects required by the Common Lisp Objects.The following categories of Common Lisp Objects are of particular interest: Numbers, characters, Symbols, Lists, arrays, structures, and functions.Lisp data types
NumbersNumber data type includes all kinds of data numbers.Integers and ratios are of type Rational.Rational  numbers and floating point numbers are of type Real.Real  numbers and complex numbers are of type Number.Numbers of type Float may be used to approximate real numbers both rational and irrational.Integer data type is used to represent common  mathematical integers.In Common Lisp there is a range of integers that are represented  more efficiently than others; each integer is called a Fixnum. ( range: -2^n to 2^n-1, inclusive)An integer that is not a fixnum is called bignum.Integers may be noted in radices other than 10. The notation #nnrddddd or #nnRddddd means the integer in radix-nn notation denoted by the digits dddd.
NumbersNumbersA ratio is the number representing the mathematical ratio of two integers.Integers and ratios collectively constitute the Rational.Rule of rational canonicalization: If any computation produces a result that is a ratio of two integers such that the denominator evenly divides the numerator, the result is immediately converted into the equivalent integer.Complex numbers( type Complex) are represented in Cartesian form, with a real part and an imaginary part, each of which is a non-complex number. Complex numbers are denoted by #c followed by a list of real and imaginary parts.Ex: #c(5 -4), #c(0 1) etc.
NumbersNumbersA floating-point  number is a rationale number of the form s.f.b^(e-p) where s is the sign(+1 or -1), b is the base(integer greater than 1), p is the precision, f is the significand ( positive integer between b^(p-1) and b^p -1 inclusive), e is the exponent. Recommended minimum Floating-point precision and Exponent Size.
CharactersCharacters are of data objects of type Character. There are 2 subtypes of interest :standard-char and string-char.A character object is denoted by writing #\ followed by the character itself.Ex: #\gThe Common Lisp character set consists of a space character#\Space and a new line character#\Newline, and the following 94 non-blank printing characters.(standard characters)! “ # $ % & ‘ ( ) + * , - . / 0 1 2 3 4 5 6 7 8 9 : ; <  > ?@ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _‘ a b c d e f g h i j k l m n o p q r s t u v w x y z { \ } ~
CharactersCharactersThe following characters are called semi-standard charecters:#\Backspace,  #\Tab,  #\Linefeed,  #\Page, #\Return, #\RuboutEvery object of type character has three attributes: code( intended to distinguish between character printed glyphs and formatting functions for characters), bits( allows extra flags to be associated with a character.) and font(specifies the specification of the style of the glyphs)Any character whose bits and fonts are zero may be contained in strings.All such characters together constitute a subtype of characters  called string-char.
SymbolsEvery object of type symbol has a name called its print-name.Symbols have a component called the property-list or plist.A symbol is notated simply by writing its name, if its name is not empty.Ex: frobbboz, +$, /user/games/sliderOther notating symbols are: + - * / @ $ % ^ & _  < > ~ .Writing an escape character(\) before any character causes the character to be treated itself as an ordinary character.Ex: \( denotes character (       \+1 denotes +1
Lists and ConsA cons is a record structure containing two components called the car and the cdr.Conses are used primarily to represent Lists.A list is a chain of conses  linked by their cdr components and terminated by nil.The car components of the conses are called the elements of the lists.A list is notated by writing the elements of the list in order, separated by blank spaces and sorrounded by parenthesis.Ex: ( a b c).A dotted-list is one whose last  cons doesn't have a nil for its cdr., after the last element and before the parenthesis is written a dot and the cdr of the last cons.Ex: ( a b c. 4), ( a . d) etc..In Lisp ( a b . ( c d)) means same as the (a b c d)
ArraysAn array is an object with the components arranged according to a Cartesian co-ordinate system.The number of dimensions of an array is called its rank.An array element is specified by a sequence of elements.The length of the sequence must be equal to the rank of the array.One may refer to array elements using the function aref.Ex: (aref foo 2 1) refers to element (2,1) of the array.
ArraysArraysMulti-dimensional arrays store their components in row-major orderInternally the multidimensional array is stored as a one-dimensional array, with the multidimensional index sets ordered lexicographically, last index varying fastest. This is important in 2 situations:When arrays with different dimensions share their contents, and
When accessing  very large arrays in virtual-memory implementation.A simple-array is one which is not displaced to another array, has no fill pointer, and is not to have its size adjusted dynamically after creation.
ArraysArraysTo create an array use the syntax:Make-array dimensions &key :element-type            :initial-element :initial-contents: adjustable:fill-pointer: displaced to: displaced-index-offset.Ex: (make array ‘(4 2 3): initial contents                             ‘(((a b c) (1 2 3))                               ((d e f) (3 1 2))                                ((g h i) (2 3 1))                                 ((j k l) (0 0 0))))
VectorsOne dimensional array is called vectors in lisp and constitute the type Lisp.Vectors and Lisps are collectively considered to be sequences.A general vectors is notated by notating the components in order sorrounded by #( and )Ex: #( a b c d ), #( ), #( 1 2 3 ) etc.
StructuresStructures are instances of user-defined data types that have a fixed number of named components.Structures are declared using the defstruct  construct.The default notation for a structure is:#s(structure-name                  slot-name-1 slot-value-1                 slot-name-2 slot-value-2                 ……….)Where #s indicates structure syntax, structure name is the name(symbol) the structure type, each slot-name is the name of the component and each corresponding slot value is the representation of the lisp object in that slot.
Hash tables provide an efficient way of mapping any LIST object (a key) to an associate object.To work with hash tables CL provides the constructor function (make-hash-table) and the accessor function( get-hash).In order to look up a key and find the associated value, (use gethash)New entries are added to hash table using the setq and gethash functions.To remove an entry use remhash.Hash Tables
Hash TablesEx: (setq a (make-hash-table))       (setf  (gethash ‘color a) ‘black)        (setq (gethash ‘name a) ‘fred)(Gethash ‘color a)black(gethash  ‘name a)fred(gethash ‘pointy a)nil
Hash TablesHash table functionsSyntax: make-hash-table &key :test :size :rehash-size :rehash-threshold:test attribute  determines how the attributes are compared, it must be one of the values( #’eq, #’eql, #’eql or one of the symbols(eq, eql, equal):size attribute sets the initial size of the hash table.:rehash-size argument specifies how much to increase the size of the hash table when it becomes full.:rehash-threshold specifies how full the hash table can be before it must grow.Ex:  (make-hash-table: re-hash size 1.5                                    :size (* number-of-widgets 43))
FunctionsFunctions are objects that can be invoked as procedures: These may take arguments and return values.A compiled function is a compiled-code object.A lambda-expression (a list whose car is the symbol lambda) may serve as a function.
Data structuresCL operators for manipulating lists as data structures are used for:Finding the length of the list
Accessing particular members of the list
Appending multiple lists together to make a new list
Extracting elements from the list to make a new list.Common lisp defines accessor function from first to tenth as a means of accessing the first ten elements of the list.Ex: (first ‘(a b c))A       (third ‘(a b c))CUse the function nth to access an element from the arbitrary list.Ex: (nth 0 ‘(a b c))A      (nth 1 ‘(a b c))B
Data structuresData structuresTo check if a particular object is lisp or  not,CL provides Listp function.It always returns either T or NILEx: (listp ‘(pontaic cadillac chevrolet))T      (listp 99)NILThe function Length is used to get the number of elements in List as an integers.Ex: (length ‘(pontaic cadillac chevrolet))3The member function is used to determine if the particular item is a member of the particular list.Ex: (member ‘dallas ‘(boston san-fransisco portland))NIL(member ‘san-fransisco’(boston san-fransisco portland))SAN-FRANSISCO PORTLAND

More Related Content

What's hot (20)

C functions
C functionsC functions
C functions
University of Potsdam
 
Church Turing Thesis
Church Turing ThesisChurch Turing Thesis
Church Turing Thesis
Hemant Sharma
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms I
Mohamed Loey
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
Nowell Strite
 
Algorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph AlgorithmsAlgorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph Algorithms
Mohamed Loey
 
LR Parsing
LR ParsingLR Parsing
LR Parsing
Eelco Visser
 
Non regular languages
Non regular languagesNon regular languages
Non regular languages
lavishka_anuj
 
Recursion in Data Structure
Recursion in Data StructureRecursion in Data Structure
Recursion in Data Structure
khudabux1998
 
Compiler Construction introduction
Compiler Construction introductionCompiler Construction introduction
Compiler Construction introduction
Rana Ehtisham Ul Haq
 
Complexity of Algorithm
Complexity of AlgorithmComplexity of Algorithm
Complexity of Algorithm
Muhammad Muzammal
 
Linear Search Presentation
Linear Search PresentationLinear Search Presentation
Linear Search Presentation
Markajul Hasnain Alif
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
Rabia Khalid
 
Indexing and Hashing
Indexing and HashingIndexing and Hashing
Indexing and Hashing
sathish sak
 
Graph data structure and algorithms
Graph data structure and algorithmsGraph data structure and algorithms
Graph data structure and algorithms
Anandhasilambarasan D
 
ProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) IntroductionProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) Introduction
wahab khan
 
insertion sort.ppt
insertion sort.pptinsertion sort.ppt
insertion sort.ppt
JawadHaider36
 
Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm
KristinaBorooah
 
Intermediate code generation in Compiler Design
Intermediate code generation in Compiler DesignIntermediate code generation in Compiler Design
Intermediate code generation in Compiler Design
Kuppusamy P
 
Constructors in C++
Constructors in C++Constructors in C++
Constructors in C++
RubaNagarajan
 
Chapter 12 ds
Chapter 12 dsChapter 12 ds
Chapter 12 ds
Hanif Durad
 
Church Turing Thesis
Church Turing ThesisChurch Turing Thesis
Church Turing Thesis
Hemant Sharma
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms I
Mohamed Loey
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
Nowell Strite
 
Algorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph AlgorithmsAlgorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph Algorithms
Mohamed Loey
 
Non regular languages
Non regular languagesNon regular languages
Non regular languages
lavishka_anuj
 
Recursion in Data Structure
Recursion in Data StructureRecursion in Data Structure
Recursion in Data Structure
khudabux1998
 
Compiler Construction introduction
Compiler Construction introductionCompiler Construction introduction
Compiler Construction introduction
Rana Ehtisham Ul Haq
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
Rabia Khalid
 
Indexing and Hashing
Indexing and HashingIndexing and Hashing
Indexing and Hashing
sathish sak
 
ProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) IntroductionProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) Introduction
wahab khan
 
Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm
KristinaBorooah
 
Intermediate code generation in Compiler Design
Intermediate code generation in Compiler DesignIntermediate code generation in Compiler Design
Intermediate code generation in Compiler Design
Kuppusamy P
 

Viewers also liked (20)

LISP: Introduction to lisp
LISP: Introduction to lispLISP: Introduction to lisp
LISP: Introduction to lisp
DataminingTools Inc
 
LISP: Input And Output
LISP: Input And OutputLISP: Input And Output
LISP: Input And Output
DataminingTools Inc
 
Learn a language : LISP
Learn a language : LISPLearn a language : LISP
Learn a language : LISP
Devnology
 
Lisp
LispLisp
Lisp
Aniruddha Chakrabarti
 
Introduction To Programming in Matlab
Introduction To Programming in MatlabIntroduction To Programming in Matlab
Introduction To Programming in Matlab
DataminingTools Inc
 
Communicating simply
Communicating simplyCommunicating simply
Communicating simply
Mustansir Husain
 
Test
TestTest
Test
spencer shanks
 
Retrieving Data From A Database
Retrieving Data From A DatabaseRetrieving Data From A Database
Retrieving Data From A Database
DataminingTools Inc
 
Control Statements in Matlab
Control Statements in  MatlabControl Statements in  Matlab
Control Statements in Matlab
DataminingTools Inc
 
Festivals Refuerzo
Festivals RefuerzoFestivals Refuerzo
Festivals Refuerzo
guest9536ef5
 
LISP:Object System Lisp
LISP:Object System LispLISP:Object System Lisp
LISP:Object System Lisp
DataminingTools Inc
 
Simulation
SimulationSimulation
Simulation
DataminingTools Inc
 
Jive Clearspace Best#2598 C8
Jive  Clearspace  Best#2598 C8Jive  Clearspace  Best#2598 C8
Jive Clearspace Best#2598 C8
mrshamilton1b
 
SPSS: File Managment
SPSS: File ManagmentSPSS: File Managment
SPSS: File Managment
DataminingTools Inc
 
LISP:Loops In Lisp
LISP:Loops In LispLISP:Loops In Lisp
LISP:Loops In Lisp
DataminingTools Inc
 
Drc 2010 D.J.Pawlik
Drc 2010 D.J.PawlikDrc 2010 D.J.Pawlik
Drc 2010 D.J.Pawlik
slrommel
 
Anime
AnimeAnime
Anime
Yarex Mussa Gonzalez
 
Association Rules
Association RulesAssociation Rules
Association Rules
DataminingTools Inc
 
LISP: Macros in lisp
LISP: Macros in lispLISP: Macros in lisp
LISP: Macros in lisp
DataminingTools Inc
 
Ad

Similar to LISP: Data types in lisp (20)

LISP: Type specifiers in lisp
LISP: Type specifiers in lispLISP: Type specifiers in lisp
LISP: Type specifiers in lisp
DataminingTools Inc
 
LISP: Type specifiers in lisp
LISP: Type specifiers in lispLISP: Type specifiers in lisp
LISP: Type specifiers in lisp
LISP Content
 
LISP: Input And Output
LISP: Input And OutputLISP: Input And Output
LISP: Input And Output
LISP Content
 
Symbol-Table concept in compiler design pdf for reference
Symbol-Table concept in compiler design pdf for referenceSymbol-Table concept in compiler design pdf for reference
Symbol-Table concept in compiler design pdf for reference
shalini s
 
11 Introduction to lists.pptx
11 Introduction to lists.pptx11 Introduction to lists.pptx
11 Introduction to lists.pptx
ssuser8e50d8
 
PRESENTATION ON STRING, LISTS AND TUPLES IN PYTHON.pptx
PRESENTATION ON STRING, LISTS AND TUPLES IN PYTHON.pptxPRESENTATION ON STRING, LISTS AND TUPLES IN PYTHON.pptx
PRESENTATION ON STRING, LISTS AND TUPLES IN PYTHON.pptx
kirtisharma7537
 
Module 4- Arrays and Strings
Module 4- Arrays and StringsModule 4- Arrays and Strings
Module 4- Arrays and Strings
nikshaikh786
 
AI UNIT-4 Final (2).pptx
AI UNIT-4 Final (2).pptxAI UNIT-4 Final (2).pptx
AI UNIT-4 Final (2).pptx
prakashvs7
 
Variables In Php 1
Variables In Php 1Variables In Php 1
Variables In Php 1
Digital Insights - Digital Marketing Agency
 
unit-5 String Math Date Time AI presentation
unit-5 String Math Date Time AI presentationunit-5 String Math Date Time AI presentation
unit-5 String Math Date Time AI presentation
MukeshTheLioner
 
Real World Haskell: Lecture 3
Real World Haskell: Lecture 3Real World Haskell: Lecture 3
Real World Haskell: Lecture 3
Bryan O'Sullivan
 
python1uhaibueuhERADGAIUSAERUGHw9uSS.pdf
python1uhaibueuhERADGAIUSAERUGHw9uSS.pdfpython1uhaibueuhERADGAIUSAERUGHw9uSS.pdf
python1uhaibueuhERADGAIUSAERUGHw9uSS.pdf
rohithzach
 
R Datatypes
R DatatypesR Datatypes
R Datatypes
r content
 
R Datatypes
R DatatypesR Datatypes
R Datatypes
DataminingTools Inc
 
Python programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operationsPython programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operations
Megha V
 
Chart and graphs in R programming language
Chart and graphs in R programming language Chart and graphs in R programming language
Chart and graphs in R programming language
CHANDAN KUMAR
 
Constants
ConstantsConstants
Constants
Jefferson Pascual
 
Unit 1-array,lists and hashes
Unit 1-array,lists and hashesUnit 1-array,lists and hashes
Unit 1-array,lists and hashes
sana mateen
 
Type header file in c++ and its function
Type header file in c++ and its functionType header file in c++ and its function
Type header file in c++ and its function
Frankie Jones
 
Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence) Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence)
wahab khan
 
LISP: Type specifiers in lisp
LISP: Type specifiers in lispLISP: Type specifiers in lisp
LISP: Type specifiers in lisp
LISP Content
 
LISP: Input And Output
LISP: Input And OutputLISP: Input And Output
LISP: Input And Output
LISP Content
 
Symbol-Table concept in compiler design pdf for reference
Symbol-Table concept in compiler design pdf for referenceSymbol-Table concept in compiler design pdf for reference
Symbol-Table concept in compiler design pdf for reference
shalini s
 
11 Introduction to lists.pptx
11 Introduction to lists.pptx11 Introduction to lists.pptx
11 Introduction to lists.pptx
ssuser8e50d8
 
PRESENTATION ON STRING, LISTS AND TUPLES IN PYTHON.pptx
PRESENTATION ON STRING, LISTS AND TUPLES IN PYTHON.pptxPRESENTATION ON STRING, LISTS AND TUPLES IN PYTHON.pptx
PRESENTATION ON STRING, LISTS AND TUPLES IN PYTHON.pptx
kirtisharma7537
 
Module 4- Arrays and Strings
Module 4- Arrays and StringsModule 4- Arrays and Strings
Module 4- Arrays and Strings
nikshaikh786
 
AI UNIT-4 Final (2).pptx
AI UNIT-4 Final (2).pptxAI UNIT-4 Final (2).pptx
AI UNIT-4 Final (2).pptx
prakashvs7
 
unit-5 String Math Date Time AI presentation
unit-5 String Math Date Time AI presentationunit-5 String Math Date Time AI presentation
unit-5 String Math Date Time AI presentation
MukeshTheLioner
 
Real World Haskell: Lecture 3
Real World Haskell: Lecture 3Real World Haskell: Lecture 3
Real World Haskell: Lecture 3
Bryan O'Sullivan
 
python1uhaibueuhERADGAIUSAERUGHw9uSS.pdf
python1uhaibueuhERADGAIUSAERUGHw9uSS.pdfpython1uhaibueuhERADGAIUSAERUGHw9uSS.pdf
python1uhaibueuhERADGAIUSAERUGHw9uSS.pdf
rohithzach
 
Python programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operationsPython programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operations
Megha V
 
Chart and graphs in R programming language
Chart and graphs in R programming language Chart and graphs in R programming language
Chart and graphs in R programming language
CHANDAN KUMAR
 
Unit 1-array,lists and hashes
Unit 1-array,lists and hashesUnit 1-array,lists and hashes
Unit 1-array,lists and hashes
sana mateen
 
Type header file in c++ and its function
Type header file in c++ and its functionType header file in c++ and its function
Type header file in c++ and its function
Frankie Jones
 
Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence) Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence)
wahab khan
 
Ad

More from DataminingTools Inc (20)

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

Recently uploaded (20)

Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdfArtificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
 
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
Edge AI and Vision Alliance
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too LateKubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureNo-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
If You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FMEIf You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FME
Safe Software
 
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOMEstablish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Anchore
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementaryMurdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
Oracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI FoundationsOracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI Foundations
VICTOR MAESTRE RAMIREZ
 
Secure Access with Azure Active Directory
Secure Access with Azure Active DirectorySecure Access with Azure Active Directory
Secure Access with Azure Active Directory
VICTOR MAESTRE RAMIREZ
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdfEdge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdfCrypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization ProgramOracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und AnwendungsfälleDomino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
panagenda
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME FlowProviding an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data ResilienceFloods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdfArtificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
 
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
Edge AI and Vision Alliance
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too LateKubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureNo-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
If You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FMEIf You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FME
Safe Software
 
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOMEstablish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Anchore
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementaryMurdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
Oracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI FoundationsOracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI Foundations
VICTOR MAESTRE RAMIREZ
 
Secure Access with Azure Active Directory
Secure Access with Azure Active DirectorySecure Access with Azure Active Directory
Secure Access with Azure Active Directory
VICTOR MAESTRE RAMIREZ
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdfEdge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdfCrypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization ProgramOracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und AnwendungsfälleDomino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
panagenda
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME FlowProviding an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data ResilienceFloods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 

LISP: Data types in lisp

  • 3. In Lisp, data type is possibly a set of lisp objects.The set of all objects is defined by the symbol t.The empty data type which contains no data objects, is defined by nil.A type called common encompasses all the data objects required by the Common Lisp Objects.The following categories of Common Lisp Objects are of particular interest: Numbers, characters, Symbols, Lists, arrays, structures, and functions.Lisp data types
  • 4. NumbersNumber data type includes all kinds of data numbers.Integers and ratios are of type Rational.Rational numbers and floating point numbers are of type Real.Real numbers and complex numbers are of type Number.Numbers of type Float may be used to approximate real numbers both rational and irrational.Integer data type is used to represent common mathematical integers.In Common Lisp there is a range of integers that are represented more efficiently than others; each integer is called a Fixnum. ( range: -2^n to 2^n-1, inclusive)An integer that is not a fixnum is called bignum.Integers may be noted in radices other than 10. The notation #nnrddddd or #nnRddddd means the integer in radix-nn notation denoted by the digits dddd.
  • 5. NumbersNumbersA ratio is the number representing the mathematical ratio of two integers.Integers and ratios collectively constitute the Rational.Rule of rational canonicalization: If any computation produces a result that is a ratio of two integers such that the denominator evenly divides the numerator, the result is immediately converted into the equivalent integer.Complex numbers( type Complex) are represented in Cartesian form, with a real part and an imaginary part, each of which is a non-complex number. Complex numbers are denoted by #c followed by a list of real and imaginary parts.Ex: #c(5 -4), #c(0 1) etc.
  • 6. NumbersNumbersA floating-point number is a rationale number of the form s.f.b^(e-p) where s is the sign(+1 or -1), b is the base(integer greater than 1), p is the precision, f is the significand ( positive integer between b^(p-1) and b^p -1 inclusive), e is the exponent. Recommended minimum Floating-point precision and Exponent Size.
  • 7. CharactersCharacters are of data objects of type Character. There are 2 subtypes of interest :standard-char and string-char.A character object is denoted by writing #\ followed by the character itself.Ex: #\gThe Common Lisp character set consists of a space character#\Space and a new line character#\Newline, and the following 94 non-blank printing characters.(standard characters)! “ # $ % & ‘ ( ) + * , - . / 0 1 2 3 4 5 6 7 8 9 : ; < > ?@ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _‘ a b c d e f g h i j k l m n o p q r s t u v w x y z { \ } ~
  • 8. CharactersCharactersThe following characters are called semi-standard charecters:#\Backspace, #\Tab, #\Linefeed, #\Page, #\Return, #\RuboutEvery object of type character has three attributes: code( intended to distinguish between character printed glyphs and formatting functions for characters), bits( allows extra flags to be associated with a character.) and font(specifies the specification of the style of the glyphs)Any character whose bits and fonts are zero may be contained in strings.All such characters together constitute a subtype of characters called string-char.
  • 9. SymbolsEvery object of type symbol has a name called its print-name.Symbols have a component called the property-list or plist.A symbol is notated simply by writing its name, if its name is not empty.Ex: frobbboz, +$, /user/games/sliderOther notating symbols are: + - * / @ $ % ^ & _ < > ~ .Writing an escape character(\) before any character causes the character to be treated itself as an ordinary character.Ex: \( denotes character ( \+1 denotes +1
  • 10. Lists and ConsA cons is a record structure containing two components called the car and the cdr.Conses are used primarily to represent Lists.A list is a chain of conses linked by their cdr components and terminated by nil.The car components of the conses are called the elements of the lists.A list is notated by writing the elements of the list in order, separated by blank spaces and sorrounded by parenthesis.Ex: ( a b c).A dotted-list is one whose last cons doesn't have a nil for its cdr., after the last element and before the parenthesis is written a dot and the cdr of the last cons.Ex: ( a b c. 4), ( a . d) etc..In Lisp ( a b . ( c d)) means same as the (a b c d)
  • 11. ArraysAn array is an object with the components arranged according to a Cartesian co-ordinate system.The number of dimensions of an array is called its rank.An array element is specified by a sequence of elements.The length of the sequence must be equal to the rank of the array.One may refer to array elements using the function aref.Ex: (aref foo 2 1) refers to element (2,1) of the array.
  • 12. ArraysArraysMulti-dimensional arrays store their components in row-major orderInternally the multidimensional array is stored as a one-dimensional array, with the multidimensional index sets ordered lexicographically, last index varying fastest. This is important in 2 situations:When arrays with different dimensions share their contents, and
  • 13. When accessing very large arrays in virtual-memory implementation.A simple-array is one which is not displaced to another array, has no fill pointer, and is not to have its size adjusted dynamically after creation.
  • 14. ArraysArraysTo create an array use the syntax:Make-array dimensions &key :element-type :initial-element :initial-contents: adjustable:fill-pointer: displaced to: displaced-index-offset.Ex: (make array ‘(4 2 3): initial contents ‘(((a b c) (1 2 3)) ((d e f) (3 1 2)) ((g h i) (2 3 1)) ((j k l) (0 0 0))))
  • 15. VectorsOne dimensional array is called vectors in lisp and constitute the type Lisp.Vectors and Lisps are collectively considered to be sequences.A general vectors is notated by notating the components in order sorrounded by #( and )Ex: #( a b c d ), #( ), #( 1 2 3 ) etc.
  • 16. StructuresStructures are instances of user-defined data types that have a fixed number of named components.Structures are declared using the defstruct construct.The default notation for a structure is:#s(structure-name slot-name-1 slot-value-1 slot-name-2 slot-value-2 ……….)Where #s indicates structure syntax, structure name is the name(symbol) the structure type, each slot-name is the name of the component and each corresponding slot value is the representation of the lisp object in that slot.
  • 17. Hash tables provide an efficient way of mapping any LIST object (a key) to an associate object.To work with hash tables CL provides the constructor function (make-hash-table) and the accessor function( get-hash).In order to look up a key and find the associated value, (use gethash)New entries are added to hash table using the setq and gethash functions.To remove an entry use remhash.Hash Tables
  • 18. Hash TablesEx: (setq a (make-hash-table)) (setf (gethash ‘color a) ‘black) (setq (gethash ‘name a) ‘fred)(Gethash ‘color a)black(gethash ‘name a)fred(gethash ‘pointy a)nil
  • 19. Hash TablesHash table functionsSyntax: make-hash-table &key :test :size :rehash-size :rehash-threshold:test attribute determines how the attributes are compared, it must be one of the values( #’eq, #’eql, #’eql or one of the symbols(eq, eql, equal):size attribute sets the initial size of the hash table.:rehash-size argument specifies how much to increase the size of the hash table when it becomes full.:rehash-threshold specifies how full the hash table can be before it must grow.Ex: (make-hash-table: re-hash size 1.5 :size (* number-of-widgets 43))
  • 20. FunctionsFunctions are objects that can be invoked as procedures: These may take arguments and return values.A compiled function is a compiled-code object.A lambda-expression (a list whose car is the symbol lambda) may serve as a function.
  • 21. Data structuresCL operators for manipulating lists as data structures are used for:Finding the length of the list
  • 23. Appending multiple lists together to make a new list
  • 24. Extracting elements from the list to make a new list.Common lisp defines accessor function from first to tenth as a means of accessing the first ten elements of the list.Ex: (first ‘(a b c))A (third ‘(a b c))CUse the function nth to access an element from the arbitrary list.Ex: (nth 0 ‘(a b c))A (nth 1 ‘(a b c))B
  • 25. Data structuresData structuresTo check if a particular object is lisp or not,CL provides Listp function.It always returns either T or NILEx: (listp ‘(pontaic cadillac chevrolet))T (listp 99)NILThe function Length is used to get the number of elements in List as an integers.Ex: (length ‘(pontaic cadillac chevrolet))3The member function is used to determine if the particular item is a member of the particular list.Ex: (member ‘dallas ‘(boston san-fransisco portland))NIL(member ‘san-fransisco’(boston san-fransisco portland))SAN-FRANSISCO PORTLAND
  • 26. Data structuresData structures continued..Subseq is a part of the list used to return a portion of the List.Ex: (subseq ‘(a b c d) 1 3)1 3 (subseq ‘(a b c d) 1)bThe function append is used to append any number of lists to an already existing list.Ex: (setq my-slides ‘(DATA TYPES)) (append my-slides ‘(IN LISP)) my-slides DATA TYPES IN LISPThe function cons is used to add a single element to the List.Ex: (cons ‘a ‘(b c d))(A B C D)
  • 27. Data structuresThe function remove is used to remove the item from the list.Ex: (setq data ‘(1 2 3 4)) (setq data(remove 3 data)) data(1 2 4)Use the function sort with #’< to sort the list in ascending order and sort function with #’> to sort the list in descending order.Ex: (setq data (sort data #’<))(1 2 4) (setq data (sort data #’>))(4 2 1) The function union, intersection and set-difference takes two Lists and computes the corresponding set operation.Ex: (union ‘(1 2 3) ‘(7 8 1))(3 2 7 8 1) (intersection ‘(1 2) ‘(7 8 1))(1)
  • 28. Property lists(plists)Property lists are used to handle keyword-value pairsPlists is a simple list with each with even number of elements. (keyword-value pairs)Ex for a plist is: (:michigan “lansing” :illinois “springfield” :pennsylavania “harrisburg”)Getf function is used to access the members of plist.Ex: (getf ‘(:michigan “lansing”:illinois “springfield”:pennsylavania “harrisburg”: illinois)) “springfield”
  • 29. 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.netVisit more self help tutorials