A structure is a user-defined data type that helps us combine different data items of different types under the same name. In Lisp, defstruct is used to define a structure of multiple data items of different data types.
Syntax:
(defstruct student name class roll-no birth-date )
In the above declaration, we have defined four named components for the structure student.
The named components take the argument in them through named functions.
An implicit function named copy-book of one argument is also defined which takes a student instance and creates another student instance, which is a clone or copy of the first one. This function is known as the copier function.
Another implicit function named make-student will be created, a constructor, which will create a data structure with four components, suitable for use with the access functions.
To read or print the instances of 'student' we can use #S syntax which itself refers to a structure.
To alter the components of the structure 'student' we can use self as we would use below.