SlideShare a Scribd company logo
Declarations in Lisp
DeclarationsDeclarations allow the user to specify extra information about the program to Lisp system.Declarations are truly optional but special declarations do effect the interpretation of the variable bindings and references and so must be specified wherever necessary.Declarations are one of the good ways to add documentation to the program.
overviewDeclaration syntaxDeclaration specifiersType declaration for forms
Declaration syntaxdeclare construct is used to embed declarations within the executable code.A declare form is known as the declaration.A declaration may occur only at the beginning of the bodies of the certain special forms.declare  {decl-spec}*
Declarations may occur in the lambda expressions and in the forms listed below:
Variable bindings appear only to the bindings made by the form at the head of whose body they appear.(defun foo (x)  (declare (type float x))..(let  (( x’a)) …)….) The type declaration applies only to the outer binding of the x and not to the binding made in the let.The scope of the declaration always includes the body forms, as well as any “stepper” or “result” forms, of the special forms or lambda-expressions.If the declaration applies to a name binding, then the scope of declaration also includes the scope of the name binding.
locally  {declaration}* {form}*This macro is used to make local pervasive declarations where desired.This construct does not bind any variables.Special declaration may be used with lacally to pervasively affect references to, rather than bindings of, variables.The function proclaim takes a decl-spec as its argument and puts it into effect globally.
proclaim decl-specThe proclaim takes decl-spec as the argument and puts it into effect globally.Ex: (proclaim ‘(type float tolerance)) specifies that the dynamic value of the tolerance should always be a floating-point number.A proclaim takes special decl-spec as applying to all bindings as well as to all references of the mentioned variables.This macro is syntactically like declare and semantically like proclaim.It is an executable form and may be used anywhere proclaim may be called.declaim {decl-spec}*
Declaration specifiersList of valid declaration  specifiers for use in declare.(special var1 var2….) specifies that all of the variables named are to be considered special.(type var1, var2,…) affects only variable bindings and specifies that the variables mentioned will take on values only of the specified type.
(ftype type function-name-1, function-name-2,…) specifies that the named functions will be of the function type type.Ex: (declare (ftype(function (integer list) t) nth)                   (ftype (function (number) float) sin cos))To extend ftype declaration specifiers to accept any function-name, one may write(declaim (ftype (function (list) t) (setf cadr)))
(inline function1, function2,…)specifies that it is desirable for the compiler to open code calls to the specified functions.The compiler is free to ignore this declaration.(notinline function1, function2,…)specifies that it is undesirable for the compiler to compile the specified functions inline.This declaration  is pervasive and the compiler is not free to ignore this declaration.(ignore var1,var2,….) affects only variable bindings and specifies that the bindings of the specified variables are never used.(optimize (quality1 value1) (quality2 vale2)…) advises compiler that each quality must be given attention according to the specified corresponding value.
(declaration name1, name2,…) advises the compiler that each namej is a valid but non-standard declaration name.The is kind of declaration may be used only as a proclamation.Ex: (proclaim ‘(declaration author                              target-language                              target-machine))   (proclaim ‘(target-language ada))   (proclaim ‘(target-machine IBM-650))(defun strangep(x)  (declare (author “Harry Tweeker”)) (member  x’(strange weird odd peculiar)))
Type declarations for formsThe special form is defined to declare the type of value held by a bound variable.(the type form)the type of value means the type of value of is declared to be of type type.the value-type formthe form is evaluated and whatever it produces is returned by the form, it is an error if what is returned by the form does not confirm to the data-type specified by value-type.
Examples:(the string (copy-seq x)) the result will be a string.(the integer (+ x 3)) the result of + will be an integer.(+ (the integer x) 3)the value of x will be an integer.
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
Ad

Recommended

Opps concept
Opps concept
divyalakshmi77
 
Lec 10
Lec 10
kapil078
 
Python Programming
Python Programming
Saravanan T.M
 
Modula 2 tutorial - 003 - declarations
Modula 2 tutorial - 003 - declarations
Julian Miglio
 
C language basics
C language basics
Nikshithas R
 
Decision making statements in C programming
Decision making statements in C programming
Rabin BK
 
Elements of c program....by thanveer danish
Elements of c program....by thanveer danish
Muhammed Thanveer M
 
C++ STATEMENTS
C++ STATEMENTS
Prof Ansari
 
CONDITIONAL STATEMENT IN C LANGUAGE
CONDITIONAL STATEMENT IN C LANGUAGE
Ideal Eyes Business College
 
Loops and conditional statements
Loops and conditional statements
Saad Sheikh
 
Storage Classes and Functions
Storage Classes and Functions
Jake Bond
 
Storage class in c
Storage class in c
kash95
 
Storage classes in C
Storage classes in C
Self employed
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02
Wingston
 
Lecture 13 - Storage Classes
Lecture 13 - Storage Classes
Md. Imran Hossain Showrov
 
Ooabapnoteswithprogram good 78
Ooabapnoteswithprogram good 78
Yogesh Mehra
 
Pl sql programme
Pl sql programme
Dhilip Prakash
 
C++ decision making
C++ decision making
Zohaib Ahmed
 
Storage classes in C
Storage classes in C
Nitesh Bichwani
 
Storage Class in C Progrmming
Storage Class in C Progrmming
Kamal Acharya
 
Lecture04(control structure part i)
Lecture04(control structure part i)
Dhaka University of Engineering & Technology(DUET)
 
First c program
First c program
NageswaraRao Gogisetti
 
C programing Tutorial
C programing Tutorial
Mahira Banu
 
11 lec 11 storage class
11 lec 11 storage class
kapil078
 
C if else
C if else
Ritwik Das
 
Norihicodanch
Norihicodanch
Filip Yang
 
Excel Datamining Addin Intermediate
Excel Datamining Addin Intermediate
DataminingTools Inc
 
Apresentação Red Advisers
Apresentação Red Advisers
mezkita
 
Festivals Refuerzo
Festivals Refuerzo
guest9536ef5
 
Art, Culture, and Technology
Art, Culture, and Technology
TVWS, LLC
 

More Related Content

What's hot (17)

CONDITIONAL STATEMENT IN C LANGUAGE
CONDITIONAL STATEMENT IN C LANGUAGE
Ideal Eyes Business College
 
Loops and conditional statements
Loops and conditional statements
Saad Sheikh
 
Storage Classes and Functions
Storage Classes and Functions
Jake Bond
 
Storage class in c
Storage class in c
kash95
 
Storage classes in C
Storage classes in C
Self employed
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02
Wingston
 
Lecture 13 - Storage Classes
Lecture 13 - Storage Classes
Md. Imran Hossain Showrov
 
Ooabapnoteswithprogram good 78
Ooabapnoteswithprogram good 78
Yogesh Mehra
 
Pl sql programme
Pl sql programme
Dhilip Prakash
 
C++ decision making
C++ decision making
Zohaib Ahmed
 
Storage classes in C
Storage classes in C
Nitesh Bichwani
 
Storage Class in C Progrmming
Storage Class in C Progrmming
Kamal Acharya
 
Lecture04(control structure part i)
Lecture04(control structure part i)
Dhaka University of Engineering & Technology(DUET)
 
First c program
First c program
NageswaraRao Gogisetti
 
C programing Tutorial
C programing Tutorial
Mahira Banu
 
11 lec 11 storage class
11 lec 11 storage class
kapil078
 
C if else
C if else
Ritwik Das
 

Viewers also liked (20)

Norihicodanch
Norihicodanch
Filip Yang
 
Excel Datamining Addin Intermediate
Excel Datamining Addin Intermediate
DataminingTools Inc
 
Apresentação Red Advisers
Apresentação Red Advisers
mezkita
 
Festivals Refuerzo
Festivals Refuerzo
guest9536ef5
 
Art, Culture, and Technology
Art, Culture, and Technology
TVWS, LLC
 
2008 IEDM presentation
2008 IEDM presentation
slrommel
 
Research Presentation
Research Presentation
guest136b28e
 
Quick Look At Classification
Quick Look At Classification
DataminingTools Inc
 
Test
Test
spencer shanks
 
Retrieving Data From A Database
Retrieving Data From A Database
DataminingTools Inc
 
Oracle: Joins
Oracle: Joins
DataminingTools Inc
 
Mysql:Operators
Mysql:Operators
DataminingTools Inc
 
Pentaho: Reporting Solution Development
Pentaho: Reporting Solution Development
DataminingTools Inc
 
Eugene SRTS Program
Eugene SRTS Program
Eugene SRTS
 
Data Mining The Sky
Data Mining The Sky
DataminingTools Inc
 
HistoriografíA Latina LatíN Ii
HistoriografíA Latina LatíN Ii
lara
 
Data Applied: Similarity
Data Applied: Similarity
DataminingTools Inc
 
Data Applied:Outliers
Data Applied:Outliers
DataminingTools Inc
 
Matlab: Discrete Linear Systems
Matlab: Discrete Linear Systems
DataminingTools Inc
 
Ad

Similar to LISP: Declarations In Lisp (20)

LISP: Scope and extent in lisp
LISP: Scope and extent in lisp
DataminingTools Inc
 
LISP: Scope and extent in lisp
LISP: Scope and extent in lisp
LISP Content
 
LISP:Control Structures In Lisp
LISP:Control Structures In Lisp
DataminingTools Inc
 
LISP: Control Structures In Lisp
LISP: Control Structures In Lisp
LISP Content
 
LISP: Type specifiers in lisp
LISP: Type specifiers in lisp
DataminingTools Inc
 
LISP: Type specifiers in lisp
LISP: Type specifiers in lisp
LISP Content
 
LISP:Program structure in lisp
LISP:Program structure in lisp
DataminingTools Inc
 
LISP: Program structure in lisp
LISP: Program structure in lisp
LISP Content
 
INTRODUCTION TO LISP
INTRODUCTION TO LISP
Nilt1234
 
LISP: Macros in lisp
LISP: Macros in lisp
DataminingTools Inc
 
LISP: Macros in lisp
LISP: Macros in lisp
LISP Content
 
1614745770521_vivek macros.pptx
1614745770521_vivek macros.pptx
VivekSaini87
 
CODING-DAY-2-INTRODUCTION TO C PROGRAMMING.ppt
CODING-DAY-2-INTRODUCTION TO C PROGRAMMING.ppt
adamjackson818417
 
Pc module1
Pc module1
SANTOSH RATH
 
C programming session7
C programming session7
Keroles karam khalil
 
C programming session7
C programming session7
Keroles karam khalil
 
Chapter-3 الشابتر الثالث هياكل بيانات جامعة خالد .pptx
Chapter-3 الشابتر الثالث هياكل بيانات جامعة خالد .pptx
HakimAlHuribi
 
Subprogram
Subprogram
baran19901990
 
Introduction to Visual Basic
Introduction to Visual Basic
Amity University | FMS - DU | IMT | Stratford University | KKMI International Institute | AIMA | DTU
 
Introduction To C
Introduction To C
gscprasad1111
 
LISP: Scope and extent in lisp
LISP: Scope and extent in lisp
LISP Content
 
LISP: Control Structures In Lisp
LISP: Control Structures In Lisp
LISP Content
 
LISP: Type specifiers in lisp
LISP: Type specifiers in lisp
LISP Content
 
LISP: Program structure in lisp
LISP: Program structure in lisp
LISP Content
 
INTRODUCTION TO LISP
INTRODUCTION TO LISP
Nilt1234
 
LISP: Macros in lisp
LISP: Macros in lisp
LISP Content
 
1614745770521_vivek macros.pptx
1614745770521_vivek macros.pptx
VivekSaini87
 
CODING-DAY-2-INTRODUCTION TO C PROGRAMMING.ppt
CODING-DAY-2-INTRODUCTION TO C PROGRAMMING.ppt
adamjackson818417
 
Chapter-3 الشابتر الثالث هياكل بيانات جامعة خالد .pptx
Chapter-3 الشابتر الثالث هياكل بيانات جامعة خالد .pptx
HakimAlHuribi
 
Ad

More from DataminingTools Inc (20)

Terminology Machine Learning
Terminology Machine Learning
DataminingTools Inc
 
Techniques Machine Learning
Techniques Machine Learning
DataminingTools Inc
 
Machine learning Introduction
Machine learning Introduction
DataminingTools Inc
 
Areas of machine leanring
Areas of machine leanring
DataminingTools Inc
 
AI: Planning and AI
AI: Planning and AI
DataminingTools Inc
 
AI: Logic in AI 2
AI: Logic in AI 2
DataminingTools Inc
 
AI: Logic in AI
AI: Logic in AI
DataminingTools Inc
 
AI: Learning in AI 2
AI: Learning in AI 2
DataminingTools Inc
 
AI: Learning in AI
AI: Learning in AI
DataminingTools Inc
 
AI: Introduction to artificial intelligence
AI: Introduction to artificial intelligence
DataminingTools Inc
 
AI: Belief Networks
AI: Belief Networks
DataminingTools Inc
 
AI: AI & Searching
AI: AI & Searching
DataminingTools Inc
 
AI: AI & Problem Solving
AI: AI & Problem Solving
DataminingTools Inc
 
Data Mining: Text and web mining
Data Mining: Text and web mining
DataminingTools Inc
 
Data 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 data
DataminingTools Inc
 
Data 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 analysis
DataminingTools Inc
 
Data warehouse and olap technology
Data warehouse and olap technology
DataminingTools Inc
 
Data Mining: Data processing
Data Mining: Data processing
DataminingTools Inc
 
AI: Introduction to artificial intelligence
AI: Introduction to artificial intelligence
DataminingTools Inc
 
Data 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 data
DataminingTools Inc
 
Data 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 analysis
DataminingTools Inc
 
Data warehouse and olap technology
Data warehouse and olap technology
DataminingTools Inc
 

Recently uploaded (20)

You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
2025_06_18 - OpenMetadata Community Meeting.pdf
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
 
"Scaling in space and time with Temporal", Andriy Lupa.pdf
"Scaling in space and time with Temporal", Andriy Lupa.pdf
Fwdays
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
Cyber Defense Matrix Workshop - RSA Conference
Cyber Defense Matrix Workshop - RSA Conference
Priyanka Aash
 
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
2025_06_18 - OpenMetadata Community Meeting.pdf
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
 
"Scaling in space and time with Temporal", Andriy Lupa.pdf
"Scaling in space and time with Temporal", Andriy Lupa.pdf
Fwdays
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
Cyber Defense Matrix Workshop - RSA Conference
Cyber Defense Matrix Workshop - RSA Conference
Priyanka Aash
 
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 

LISP: Declarations In Lisp

  • 2. DeclarationsDeclarations allow the user to specify extra information about the program to Lisp system.Declarations are truly optional but special declarations do effect the interpretation of the variable bindings and references and so must be specified wherever necessary.Declarations are one of the good ways to add documentation to the program.
  • 4. Declaration syntaxdeclare construct is used to embed declarations within the executable code.A declare form is known as the declaration.A declaration may occur only at the beginning of the bodies of the certain special forms.declare {decl-spec}*
  • 5. Declarations may occur in the lambda expressions and in the forms listed below:
  • 6. Variable bindings appear only to the bindings made by the form at the head of whose body they appear.(defun foo (x) (declare (type float x))..(let (( x’a)) …)….) The type declaration applies only to the outer binding of the x and not to the binding made in the let.The scope of the declaration always includes the body forms, as well as any “stepper” or “result” forms, of the special forms or lambda-expressions.If the declaration applies to a name binding, then the scope of declaration also includes the scope of the name binding.
  • 7. locally {declaration}* {form}*This macro is used to make local pervasive declarations where desired.This construct does not bind any variables.Special declaration may be used with lacally to pervasively affect references to, rather than bindings of, variables.The function proclaim takes a decl-spec as its argument and puts it into effect globally.
  • 8. proclaim decl-specThe proclaim takes decl-spec as the argument and puts it into effect globally.Ex: (proclaim ‘(type float tolerance)) specifies that the dynamic value of the tolerance should always be a floating-point number.A proclaim takes special decl-spec as applying to all bindings as well as to all references of the mentioned variables.This macro is syntactically like declare and semantically like proclaim.It is an executable form and may be used anywhere proclaim may be called.declaim {decl-spec}*
  • 9. Declaration specifiersList of valid declaration specifiers for use in declare.(special var1 var2….) specifies that all of the variables named are to be considered special.(type var1, var2,…) affects only variable bindings and specifies that the variables mentioned will take on values only of the specified type.
  • 10. (ftype type function-name-1, function-name-2,…) specifies that the named functions will be of the function type type.Ex: (declare (ftype(function (integer list) t) nth) (ftype (function (number) float) sin cos))To extend ftype declaration specifiers to accept any function-name, one may write(declaim (ftype (function (list) t) (setf cadr)))
  • 11. (inline function1, function2,…)specifies that it is desirable for the compiler to open code calls to the specified functions.The compiler is free to ignore this declaration.(notinline function1, function2,…)specifies that it is undesirable for the compiler to compile the specified functions inline.This declaration is pervasive and the compiler is not free to ignore this declaration.(ignore var1,var2,….) affects only variable bindings and specifies that the bindings of the specified variables are never used.(optimize (quality1 value1) (quality2 vale2)…) advises compiler that each quality must be given attention according to the specified corresponding value.
  • 12. (declaration name1, name2,…) advises the compiler that each namej is a valid but non-standard declaration name.The is kind of declaration may be used only as a proclamation.Ex: (proclaim ‘(declaration author target-language target-machine))  (proclaim ‘(target-language ada)) (proclaim ‘(target-machine IBM-650))(defun strangep(x) (declare (author “Harry Tweeker”)) (member x’(strange weird odd peculiar)))
  • 13. Type declarations for formsThe special form is defined to declare the type of value held by a bound variable.(the type form)the type of value means the type of value of is declared to be of type type.the value-type formthe form is evaluated and whatever it produces is returned by the form, it is an error if what is returned by the form does not confirm to the data-type specified by value-type.
  • 14. Examples:(the string (copy-seq x)) the result will be a string.(the integer (+ x 3)) the result of + will be an integer.(+ (the integer x) 3)the value of x will be an integer.
  • 15. 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