Property List of Lisp Programmingss

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 10

Property list of lisp

programming
Ilias ahmed
Agenda
Property list of lisp programming agenda:
Setf
Getf
Putprof
Remprop
Printing and accessing properties

PRESENTATION TITLE 2
Introduction

Lisp programming, a property list (often referred to as a "list") is a simple and


flexible data structure for associating values with keys. It is essentially a list
of alternating keys and values. The keys are typically symbols or strings, and
the values can be any Lisp data type.

Property list of lisp programming 3


Introduction

In Lisp programming, setf is a powerful macro used for general value assignment.
It provides a consistent and flexible way to set the values of variables,
including modifying data structures like lists, arrays, and properties.
When it comes to properties,
setf is often used in conjunction with get to update or change the values associated
with specific keys in a property list or other data structures.

Property list of lisp programming 4


putprop

In Lisp programming, putprop is a function that is used to


associate a property value with a symbol.

It's a part of Common Lisp and is typically used for attaching


additional information or properties to symbols.

Property list of lisp programming 5


remprop

remprop is a function used to remove a property from a symbol. It is typically used


in conjunction with putprop to manage properties associated with symbols.

Property list of lisp programming 6


properties for a person represented by an atom using a property list in Lisp:
Lisp programming
(setq person (make-symbol "example-person")) (setq person-properties '(

(setq person (make-symbol "example-person"))

(setq person-properties
'(
:first-name “ilias "
:last-name “Ahmed"
:age 49
:gender "Male"

Conitnuee……
:occupation "Data Scientist"
:hobbies '("Reading" "Coding" "Swimming")
:languages '("Lisp" "Python" "R")
:height 180
:weight 75
:education “Msc in CSE"
:email “ilias.ahmed.2021@gmail.com"
:phone “01718556889"
:address “500 Shamim sorony Mirpur dhaka"
:is-student t
:is-employee t
:has-license t
:birthplace “kishregonj"
:nationality “Bangladeshi"
:marital-status "Married"
:children ‘(“sabiha" “anantoo")
:pets '("Cat" "Dog")
:favorite-color "Green"
:favorite-book "The python Revolution"
:sports '("Tennis" "Basketball")
:music-genres '("Jazz" "Rock" "Classical")
:work-experience '("Data Analyst" "Researcher")
:certifications '("Data Science Professional" “data analyst Expert")
:interests '("Machine Learning" "Data Visualization")
;; Set properties using putprop

(putprop 'person 'Ilias 'name)


(putprop 'person 49 'age)
(putprop 'person "Data Scientist" 'occupation)
(putprop 'person “500 dhanmondi" 'occupation)
(putprop 'person “abc@gmail.com" ‘email)

;; Change the value of the address property using setf


(setf (get 'person 'address) "501 dhanmondi")

;; Get and print specific properties


(format t "Name: (get 'person 'name))
(format t "Age: (get 'person 'age))

;; Remove the email property using remprop

(remprop 'person 'email)


thanks
Ilias ahmed
Msc in cse

You might also like