Data types are subclasses of data objects used in programming languages. Primary types of data are, for example, numbers, strings, logical values etc. From them it is possible to form aggregate types further.
More precisely the data type is understood as a range which can have identical objects or copies of the given type. Necessary objects can be defined obviously, having enumerated their or their names. The second possibility is definition of objects implicitly in the form of a class, describing their structure and properties. In the latter case processed objects form as required.
In Lisp it is used both obvious, and implicit ways of definition. For example, symbols as those do not demand definition or the description before their usage. Their type is defined automatically on the basis of the form and a position in which they meet.
Originally for a basis for selection of various data types was, an internal data format in memory of the computer. As data of various types were handled by different commands it has appeared useful to unite formal type declaration with the description of applied operations. Benefit received from it becomes especially obvious, than is more used new various types. In connection with designing of language Algol-68 became clear, exact definition as data types, and operations over them as was important. It has begun development of special area of the researches named as the theory of abstract types of data.
As abstraction of data understand separation of properties of data from data objects. The abstract type of data is understood as a data type which is defined through applicable operations to the given type irrespective of the fact how values of objects of the given type are presented.
For example, lists derivate an abstract type of data. Its objects can be realised by means of list cells and pointers or any other structure or a data type. Base functions derivate set of operations (type methods). They can be applied to lists irrespective of the fact how last are realised on more low level of abstraction.
Using abstraction of data types, the programmer can forget about technical implementation (values of objects) type which from the point of view of data representation from problem area is unessential, and to concentrate on solution of the problem. At the same time calculations in system it is naturally arranged between various data types.
Abstract types of data offer a natural way of splitting of the program on units, specifications and verifications of units. By means of abstraction of data it is possible to simplify programming, reducing quantity of errors and to create more readable and easily updated programs in which it is possible to change data structures, not bringing the big changes in programs.
The abstraction of data allows to define the universal operations looking from the point of view of the user equally, but realised in unusual way depending on types of objects. It simplifies programming and support of programs. Changing the program, it is not necessary to make changes in all places where the given type is used. It is enough to make changes to a type definition. This circumstance is especially important in that case when programs are great on the sizes or when over them some programmers work.
Within the limits of researches on an artificial intelligence within several decades numerous data structures and forms of their representation have been offered and fulfilled. Some of them already from the very beginning were a part Lisp (for example, so-called association lists and property lists). Advanced designs some more were included into Lisp-systems later (for example, objects). Except them the data types used in other programming languages have been included in Lisp-systems, are various sorts of numbers, strings, vectors etc.
Thanks to natural expandability and openness Lisp in language it was simple to define new data types and resources of abstraction of data. In one other programming language there will be no so wide and polygonal choice of ready data types and resources for definition of new types, as in Lisp. However lists and operation with them derivate the base mechanism by means of which it is possible to use and unite in a single whole Lisp objects of various types and with which help it is possible to realise new ways of data representation.
By operation with data types distinguish two main operations: construction of the object and performance of its method. There is in types an own method the designer, it is fulfilled at object creation.
The data type made from base or before certain types, name as a class. If the new class and the methods linked to it are defined, objects belonging to it can be used, not knowing their internal structure, a way of representation and procedure of access more a low level.
In a data object it is possible to distinguish his name, the object, or value, and object type. An object name is the character which is used as a variable or as the representative of the object. The object type defines its common properties.
In Lisp the data object type is linked not to his name, and with the object. It Lisp differs from many other things programming languages. For example, in Pascal to names of variables the certain type is assigned, and variables cannot be used for representation of objects of other type. In the Fortran in turn behind a part of names of variables the type is fixed already in definition of language since 1950th years (the names starting on the characters i, j and k). Type fixing is usually carried out at a spelling of the program at the moment of a variable declaration, and it cannot be changed during program operation.
In Lisp as value the character can assign the object of any type (number, the character, the list, string, a vector, a stream, the object, function, a macro etc.), not caring about a variable type. The same variable can in various instants and in various conditions to represent Lisp objects of various types. Correspondence of value of a real situation, for example argument of function, is checked only during concrete calculation.
Recognising that variables have no types, Lisp name as a typeless language. The similar term does not mean that in language in general there are no data types. Dynamism of types together with abstraction of data and universal definition of operations allows to write programs in more simple and shorter form, than in traditional languages.
For the objects having various types, the functions at base level are necessary. Besides, for each type the predicate checking an accessory to this type is necessary. For example, (nil atom x) checks, whether is x atom. Along with the predicates distinguishing types (atom, consp, listp, numberp, stringp, vectorp and others), the object type can be defined and by means of function class-of which returns argument class definition as value:
Conversion functions with which help it is possible to transform data objects from one type to another are besides, necessary.
>("Abc" list) ; from string in the list of characters
(#\A #\b #\c)
>(1/3 string) ; from number in string
"1/3"
Data types derivate conceptual hierarchy: the classes of types allocated more low automatically enter and into more abstract class of the given type allocated above. Most the common type is the type nil.
The intrinsic functions defined for type, allocated above on hierarchy, it is possible to apply and to the objects which types belong more to low levels.
>(nil if true 1 2)
1
>("test" if true 1 2)
1
Let's notice, that if there was no such hierarchy of types it should to use for the denotation of similar operations functions with various names.
>(nil string)
"nil"
>(true string)
"true"
>(1 string)
"1"
Along with already existing types the programmer can define itself the form defclass the new classes of objects oriented to the task. For classes it is possible to define further hierarchy, for fields to set defaults, using the designer.
Differentiation between system and used in solution of a specific target by types often is so difficult, as between system and user's functions.
The concept of objects appears especially useful and scalene resource for implementation of new, especially "active" types. The objective thinking is viewed including in hierarchy of types.