SlideShare a Scribd company logo
Object System Lisp
overviewProgrammer interface conceptsClassesSlotsInheritanceGeneric functions and methodsIntroduction to generic functionsIntroduction to methodsStandard method classes and method objectsObject creation and initializationExtensions
Programmer interface conceptsThe common lisp open system(CLOS) is an object-oriented extension to Common Lisp.In the standard programmer interface of CLOS, we have,The first part, Programmer interface concepts
The second part, Functions in  programmers interface, contains a description of the functions and macros in CLOS programmers interface.
The third part, common lisp object system meta-object protocol, explains how the CLOS has to be customized.classesA class is an object that determines the structure and the behavior of a set of other objects, which are called its instances.A class can inherit structure and behavior from other classes.A class whose definition refers to other classes for the purpose of inheriting The classes that are designated for the purpose of inheritance are said to be the super classes of the inheriting class.
The function class-name takes a class object and returns its nameEach class has a class precedence list, which is the total ordering on the set of the given class and its super classes.The total ordering is a list ordered from the most specific to least specific.
Defining classesThe macro defmacro is used to define a new named class.The definition includesName of the new class.
List of the directed super classes of the new class
A set of slot specifiers
A set of class optionsThe generic function make-instance creates and returns a new instance of a class.
slotsAn object that has standard-class as its metaclass has zero or more slots.The slots of an object are determined by the class of the object.Each slot can hold one value.The default initial value of a slot is defined by the :initform slot option.
A local slot is the one that is visible to exactly one instance, namely the one in which the slot is allocated.A shared slot is defined to be a slot that is visible to more than one instance of a given class and its subclassesA slot can be accessed in two ways: by the use of primitive function slot-value.
By use of generic functions generated by the defclass form.InheritanceA class can inherit methods, slots and some defclass options from its super classes.A subclass inherits methods in the sense that any method applicable to all instances of a class is also applicable to all instances of any subclass of that class.Inheritance of class options:The :default-initargs class option is inheritedEx: ( defclass c1 ()        ((s1 :initform 5.4 :type number)          (s2 :allocation :class))) Instances of class c1 have a local slot named s1, whose default initial value is 5.4
s1 should always be a number.
Class c1 also has a shared slot named s2.(defclass c2 (c1)       ((s1 :initform 5 :type integer)        (s2 :allocation :instance)        (s3 :accessor c2-s3)))There is a local slot named s1 in instances of c2.
The default initial value of s1 is 5.
The value of s1 will be of type integer.
There are also local slots of named s2 and s3 in instances of c2.
The class c2 has a method for c2-s3 for reading the value of slot s3.Determining the class precedence ListThe defclass form for a class provides a total ordering on that class and its direct super classes.This ordering is called the local precedence order.The class precedence list for a class C is a total ordering on C and its super classes that is consistant with the local precedence orders for C and its super classes.
Class precedence list ArrayBit-vectorCharacterComplexConsFloatFunction*Hash-table*IntegerListNull
NumberPackage*Pathname*Random-state*RatioRationalReadtable*SequenceStream*StringSymboltvector
Introduction to generic functionsA generic function object contains a set of methods, lambda-list, a method combination type, and other information.A generic function can be given a global name using the defmethod and defgeneric construct.A generic function can be given a local name using generic-flet, generic-labels, or with-added-method special forms.
Introduction to methodsA method object contains a method function, a sequence of parameter specializes which specify when the given method is applicable, a lambda-list and a sequence of qualifiers.A method-defining form contains the code that is to be run when the arguments for the generic function cause the method that it defines to be invoked.
Congruent lambda-list for all methods of a generic function Each lambda-list must have the same number of required parametersEach lambda-list must have the same number of optional.If any lambda-list mentions &rest or &key, each lambda-list must mention one or both of them.If the generic function lambda-list mentions &key, each method must accept all of the keyword names mentioned after &key, either  by accepting them explicitly, by specifying &allow-other-keys, or by specifying &rest but and &key.
Standard method combinationStandard method combination is supported by the class standard-generic-function.Primary functions define the main action of the effective method, while auxiliary methods modify that action in one of three ways:A primary method has no method qualifier.An auxiliary method is a method whose method qualifier is :before, :after, or :aroundThe macro define-method-combination defines new forms of method combinations.It provides an effective method for customizing the production of the effective method.

More Related Content

PPTX
chap 6 : Objects and classes (scjp/ocjp)
It Academy
 
PPTX
Evolution of c# - by K.Jegan
talenttransform
 
PPTX
Dynamic method dispatch
yugandhar vadlamudi
 
PPTX
encapsulation, inheritance, overriding, overloading
Shivam Singhal
 
PDF
Lecture 8 Library classes
Syed Afaq Shah MACS CP
 
PPTX
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
DevaKumari Vijay
 
PPTX
Lecture 6 inheritance
manish kumar
 
PPTX
Unit3 part1-class
DevaKumari Vijay
 
chap 6 : Objects and classes (scjp/ocjp)
It Academy
 
Evolution of c# - by K.Jegan
talenttransform
 
Dynamic method dispatch
yugandhar vadlamudi
 
encapsulation, inheritance, overriding, overloading
Shivam Singhal
 
Lecture 8 Library classes
Syed Afaq Shah MACS CP
 
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
DevaKumari Vijay
 
Lecture 6 inheritance
manish kumar
 
Unit3 part1-class
DevaKumari Vijay
 

What's hot (20)

PPT
Refactoring bad codesmell
hyunglak kim
 
PPTX
Lecture 4_Java Method-constructor_imp_keywords
manish kumar
 
DOCX
JAVA Notes - All major concepts covered with examples
Sunil Kumar Gunasekaran
 
PPTX
Unit3 part2-inheritance
DevaKumari Vijay
 
PPSX
Java session4
Jigarthacker
 
PPT
Chapter 13 - Inheritance and Polymorphism
Eduardo Bergavera
 
PPTX
Lecture 8 abstract class and interface
manish kumar
 
DOC
My c++
snathick
 
PPT
L7 inheritance
teach4uin
 
PPTX
Inheritance and Polymorphism Java
M. Raihan
 
PPTX
Ppt on this and super keyword
tanu_jaswal
 
PPTX
Unit3 inheritance
Kalai Selvi
 
PPTX
Lecture - 3 Variables-data type_operators_oops concept
manish kumar
 
PDF
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Tushar B Kute
 
PPT
packages and interfaces
madhavi patil
 
PPT
Generics in java
suraj pandey
 
PPT
البرمجة الهدفية بلغة جافا - الوراثة
Mahmoud Alfarra
 
PPSX
Seminar on java
shathika
 
PPTX
Java Generics
DeeptiJava
 
PPTX
Class and object
prabhat kumar
 
Refactoring bad codesmell
hyunglak kim
 
Lecture 4_Java Method-constructor_imp_keywords
manish kumar
 
JAVA Notes - All major concepts covered with examples
Sunil Kumar Gunasekaran
 
Unit3 part2-inheritance
DevaKumari Vijay
 
Java session4
Jigarthacker
 
Chapter 13 - Inheritance and Polymorphism
Eduardo Bergavera
 
Lecture 8 abstract class and interface
manish kumar
 
My c++
snathick
 
L7 inheritance
teach4uin
 
Inheritance and Polymorphism Java
M. Raihan
 
Ppt on this and super keyword
tanu_jaswal
 
Unit3 inheritance
Kalai Selvi
 
Lecture - 3 Variables-data type_operators_oops concept
manish kumar
 
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Tushar B Kute
 
packages and interfaces
madhavi patil
 
Generics in java
suraj pandey
 
البرمجة الهدفية بلغة جافا - الوراثة
Mahmoud Alfarra
 
Seminar on java
shathika
 
Java Generics
DeeptiJava
 
Class and object
prabhat kumar
 
Ad

Viewers also liked (9)

PPT
PS3 GAME SCREENSHOT
angelus_d
 
PPTX
Cocacola
juanesDPE
 
DOCX
Mar jonagold
Gherghescu Gabriel
 
PPS
Snæfellsjökull
nemandi
 
PPTX
Aula 9 ferramentas da epidemiologia clínica para um diagnóstico
Ricardo Alexandre
 
PDF
Alicevieira 120523033823-phpapp02
becastanheiradepera
 
PPT
APRESENTAÇÃO SINERGIAS
sinergias
 
PDF
Elogio de la persuasión (en situaciones de discapacidad).
José María
 
DOCX
Guia 01
samy meza alvarez
 
PS3 GAME SCREENSHOT
angelus_d
 
Cocacola
juanesDPE
 
Mar jonagold
Gherghescu Gabriel
 
Snæfellsjökull
nemandi
 
Aula 9 ferramentas da epidemiologia clínica para um diagnóstico
Ricardo Alexandre
 
Alicevieira 120523033823-phpapp02
becastanheiradepera
 
APRESENTAÇÃO SINERGIAS
sinergias
 
Elogio de la persuasión (en situaciones de discapacidad).
José María
 
Ad

Similar to LISP: Object Sytstem Lisp (20)

PPTX
Meta Object Protocols
Pierre de Lacaze
 
DOCX
Object oriented basics
vamshimahi
 
PPTX
LISP: Data types in lisp
LISP Content
 
PPTX
LISP: Data types in lisp
DataminingTools Inc
 
PPT
Objectorientedprogrammingmodel1
bharath yelugula
 
KEY
Ruby Internals
Burke Libbey
 
PPT
Classes & objects new
lykado0dles
 
PDF
Euclideus_Language
Justin Gagnon
 
PPTX
LISP: Type specifiers in lisp
LISP Content
 
PPTX
LISP: Type specifiers in lisp
DataminingTools Inc
 
DOC
Delphi qa
sandy14234
 
PDF
Oop basic concepts
Swarup Kumar Boro
 
DOCX
Object oriented Programming ____ABAP.docx
dileepab99
 
KEY
Ruby
Kerry Buckley
 
PPT
Rubyforjavaprogrammers 1210167973516759-9
sagaroceanic11
 
PPT
Rubyforjavaprogrammers 1210167973516759-9
sagaroceanic11
 
PDF
Introduction To Lisp
kyleburton
 
PPTX
Ruby object model
Chamnap Chhorn
 
PDF
Anton Kasyanov, Introduction to Python, Lecture5
Anton Kasyanov
 
PDF
Ruby — An introduction
Gonçalo Silva
 
Meta Object Protocols
Pierre de Lacaze
 
Object oriented basics
vamshimahi
 
LISP: Data types in lisp
LISP Content
 
LISP: Data types in lisp
DataminingTools Inc
 
Objectorientedprogrammingmodel1
bharath yelugula
 
Ruby Internals
Burke Libbey
 
Classes & objects new
lykado0dles
 
Euclideus_Language
Justin Gagnon
 
LISP: Type specifiers in lisp
LISP Content
 
LISP: Type specifiers in lisp
DataminingTools Inc
 
Delphi qa
sandy14234
 
Oop basic concepts
Swarup Kumar Boro
 
Object oriented Programming ____ABAP.docx
dileepab99
 
Rubyforjavaprogrammers 1210167973516759-9
sagaroceanic11
 
Rubyforjavaprogrammers 1210167973516759-9
sagaroceanic11
 
Introduction To Lisp
kyleburton
 
Ruby object model
Chamnap Chhorn
 
Anton Kasyanov, Introduction to Python, Lecture5
Anton Kasyanov
 
Ruby — An introduction
Gonçalo Silva
 

More from LISP Content (11)

PPTX
LISP: Control Structures In Lisp
LISP Content
 
PPTX
LISP:Declarations In Lisp
LISP Content
 
PPTX
LISP: Errors In Lisp
LISP Content
 
PPTX
LISP: Input And Output
LISP Content
 
PPTX
LISP: Loops In Lisp
LISP Content
 
PPTX
LISP: Symbols and packages in lisp
LISP Content
 
PPTX
LISP: Scope and extent in lisp
LISP Content
 
PPTX
LISP: Program structure in lisp
LISP Content
 
PPTX
LISP: Predicates in lisp
LISP Content
 
PPTX
LISP: Macros in lisp
LISP Content
 
PPTX
LISP: Introduction To Lisp
LISP Content
 
LISP: Control Structures In Lisp
LISP Content
 
LISP:Declarations In Lisp
LISP Content
 
LISP: Errors In Lisp
LISP Content
 
LISP: Input And Output
LISP Content
 
LISP: Loops In Lisp
LISP Content
 
LISP: Symbols and packages in lisp
LISP Content
 
LISP: Scope and extent in lisp
LISP Content
 
LISP: Program structure in lisp
LISP Content
 
LISP: Predicates in lisp
LISP Content
 
LISP: Macros in lisp
LISP Content
 
LISP: Introduction To Lisp
LISP Content
 

Recently uploaded (20)

PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PPTX
Stamford - Community User Group Leaders_ Agentblazer Status, AI Sustainabilit...
Amol Dixit
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PPTX
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
PDF
Revolutionize Operations with Intelligent IoT Monitoring and Control
Rejig Digital
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PPT
L2 Rules of Netiquette in Empowerment technology
Archibal2
 
PDF
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
Best ERP System for Manufacturing in India | Elite Mindz
Elite Mindz
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
Software Development Company | KodekX
KodekX
 
PDF
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
Stamford - Community User Group Leaders_ Agentblazer Status, AI Sustainabilit...
Amol Dixit
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
Revolutionize Operations with Intelligent IoT Monitoring and Control
Rejig Digital
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
L2 Rules of Netiquette in Empowerment technology
Archibal2
 
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
Best ERP System for Manufacturing in India | Elite Mindz
Elite Mindz
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
Software Development Company | KodekX
KodekX
 
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
Software Development Methodologies in 2025
KodekX
 
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 

LISP: Object Sytstem Lisp

  • 2. overviewProgrammer interface conceptsClassesSlotsInheritanceGeneric functions and methodsIntroduction to generic functionsIntroduction to methodsStandard method classes and method objectsObject creation and initializationExtensions
  • 3. Programmer interface conceptsThe common lisp open system(CLOS) is an object-oriented extension to Common Lisp.In the standard programmer interface of CLOS, we have,The first part, Programmer interface concepts
  • 4. The second part, Functions in programmers interface, contains a description of the functions and macros in CLOS programmers interface.
  • 5. The third part, common lisp object system meta-object protocol, explains how the CLOS has to be customized.classesA class is an object that determines the structure and the behavior of a set of other objects, which are called its instances.A class can inherit structure and behavior from other classes.A class whose definition refers to other classes for the purpose of inheriting The classes that are designated for the purpose of inheritance are said to be the super classes of the inheriting class.
  • 6. The function class-name takes a class object and returns its nameEach class has a class precedence list, which is the total ordering on the set of the given class and its super classes.The total ordering is a list ordered from the most specific to least specific.
  • 7. Defining classesThe macro defmacro is used to define a new named class.The definition includesName of the new class.
  • 8. List of the directed super classes of the new class
  • 9. A set of slot specifiers
  • 10. A set of class optionsThe generic function make-instance creates and returns a new instance of a class.
  • 11. slotsAn object that has standard-class as its metaclass has zero or more slots.The slots of an object are determined by the class of the object.Each slot can hold one value.The default initial value of a slot is defined by the :initform slot option.
  • 12. A local slot is the one that is visible to exactly one instance, namely the one in which the slot is allocated.A shared slot is defined to be a slot that is visible to more than one instance of a given class and its subclassesA slot can be accessed in two ways: by the use of primitive function slot-value.
  • 13. By use of generic functions generated by the defclass form.InheritanceA class can inherit methods, slots and some defclass options from its super classes.A subclass inherits methods in the sense that any method applicable to all instances of a class is also applicable to all instances of any subclass of that class.Inheritance of class options:The :default-initargs class option is inheritedEx: ( defclass c1 () ((s1 :initform 5.4 :type number) (s2 :allocation :class))) Instances of class c1 have a local slot named s1, whose default initial value is 5.4
  • 14. s1 should always be a number.
  • 15. Class c1 also has a shared slot named s2.(defclass c2 (c1) ((s1 :initform 5 :type integer) (s2 :allocation :instance) (s3 :accessor c2-s3)))There is a local slot named s1 in instances of c2.
  • 16. The default initial value of s1 is 5.
  • 17. The value of s1 will be of type integer.
  • 18. There are also local slots of named s2 and s3 in instances of c2.
  • 19. The class c2 has a method for c2-s3 for reading the value of slot s3.Determining the class precedence ListThe defclass form for a class provides a total ordering on that class and its direct super classes.This ordering is called the local precedence order.The class precedence list for a class C is a total ordering on C and its super classes that is consistant with the local precedence orders for C and its super classes.
  • 20. Class precedence list ArrayBit-vectorCharacterComplexConsFloatFunction*Hash-table*IntegerListNull
  • 22. Introduction to generic functionsA generic function object contains a set of methods, lambda-list, a method combination type, and other information.A generic function can be given a global name using the defmethod and defgeneric construct.A generic function can be given a local name using generic-flet, generic-labels, or with-added-method special forms.
  • 23. Introduction to methodsA method object contains a method function, a sequence of parameter specializes which specify when the given method is applicable, a lambda-list and a sequence of qualifiers.A method-defining form contains the code that is to be run when the arguments for the generic function cause the method that it defines to be invoked.
  • 24. Congruent lambda-list for all methods of a generic function Each lambda-list must have the same number of required parametersEach lambda-list must have the same number of optional.If any lambda-list mentions &rest or &key, each lambda-list must mention one or both of them.If the generic function lambda-list mentions &key, each method must accept all of the keyword names mentioned after &key, either by accepting them explicitly, by specifying &allow-other-keys, or by specifying &rest but and &key.
  • 25. Standard method combinationStandard method combination is supported by the class standard-generic-function.Primary functions define the main action of the effective method, while auxiliary methods modify that action in one of three ways:A primary method has no method qualifier.An auxiliary method is a method whose method qualifier is :before, :after, or :aroundThe macro define-method-combination defines new forms of method combinations.It provides an effective method for customizing the production of the effective method.
  • 26. Meta objectsThe meta-object protocol specifies a set of generic functions defined by methods on classes.The instances of these classes on which those methods are defined are called meta-objects.The metaclass determines the representation of instances of its instances and the forms of inheritance used by its instances for slot descriptions and method inheritance.
  • 27. Standard Meta-classes and objectsThe common lisp provides a set of meta-classes which includeStandard-class (default class)
  • 28. Built-in-class (instances are classes that have special implementations with restricted capabilities)
  • 29. Structure-class (all classes defined by means of defstruct are instances of structure-class)Set of metaobjects provided by the common lisp include:Standard-method (default class of methods)
  • 31. instance of the class standard class
  • 32. Method-combination (every method combination object is an instance of a subclass of the class method-combination)Object creation and initializationThe generic function make-instance creates and returns a new instance of a class.The first argument is a class or the name of the class , and the remaining arguments form an initialization argument list.An initialization argument controls object creation and initialization.Keyword symbols are used to make initialization objects.A default value form can be used for an initialization argument by using the :default-initargs class option.
  • 33. Rules to specify when initialization arguments may be multiply defined:A given initialization argument can be used to initialize more than one slot if the same initialization argument name appears in more than one :initarg slot option.A given initialization argument name can appear in the lambda-list of more than one initialization method.A given initialization argument name can appear in an :initarg slot option and in the lambda-list of an initialization method.
  • 34. Redefining a classA class that is an instance of standard-class can be redefined if the new class will also be an instance of standard-class.Redefining modifies the existing class object, it does not create a new class object for the class.Any method object created by :reader, :writer, or :accessor option specified by the old defclass form the corresponding generic functions and methods specified by the new defclass form are added.
  • 35. extensionsThere are two extensions allowed for class redefinition:The object system may be extended to permit the new class to be an instance of a metaclass other than the metaclass of the old class.
  • 36. The object system may be extended to support an updating process when either the old or new class is an instance of a class other than standard-class that is not a built-in class.Visit more self help tutorialsPick 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