Concepts

Obvious and implicit definition

  Types of data are subclasses of objects of data used in programming languages. Simple types of data are, for example, numbers, lines, logic values, etc. It is possible to form compound types of them further.
  More precisely the type of data is understood as set of values which can have identical objects or copies of the given type. Necessary objects can be defined obviously, having listed their or their names. The second opportunity is definition of objects implicitly in the form of a class, describing their structure and properties. In the latter case processable objects are created as required.
  In Lisp is used both obvious, and implicit ways of definition. For example, symbols as those do not demand definition or the description before their use. Their type is defined automatically on the basis of the form and a position in which they meet.

Abstraction of data

  Originally as a basis for allocation of various types of data served, an internal format of data presentation in memory of the machine. As data of various types were processed by different commands it has appeared useful to unite the formal description of type with the description of applied actions. 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 types of data, and actions above them however was important. It has begun development of special area of the researches named by the theory of abstract types of data.
  As abstraction of data understand branch of properties of data from objects of data. The abstract type of data is understood as type of data which is certain through to appliable to the given type of operation irrespective of the fact how values of objects of the given type are presented.
  For example, lists form abstract type of data. Its objects can be realized by means of list cells and indexes or any other structure or type of data. Base functions form set of operations (methods of type). They can be applied to lists irrespective of the fact how the last are realized at lower level of abstraction.
  Using abstraction of types of data, the programmer can forget about technical realization (values of objects) type which from the point of view of data presentation from problem area is insignificant, and to concentrate on the decision of the problem. At the same time calculations in system it is naturally distributed between various types of data.
  Abstract types of data offer a natural way of splitting of the program on modules, specifications and verifications of modules. By means of abstraction of data it is possible to simplify programming, reducing quantity of mistakes and to create more readable and easily modified programs in which it is possible to change structures of data, not bringing greater changes in programs.
  The abstraction of data allows to define the universal actions looking from the point of view of the user equally, but realized in unusual way depending on types of objects. It simplifies programming and support of programs. Changing the program, it is not necessary to do changes in all places where the given type is used. It is enough to make changes to definition of type. This circumstance is especially important in that case when programs are great in the sizes or when above them some programmers work.
  Within the limits of researches on an artificial intellect within several decades numerous structures of data and forms of their representation have been offered and fulfilled. Some of them already from the very beginning were a part of Lisp (for example, so-called associative lists and lists of properties). Some newer development were included into Lisp-systems later (for example, objects). Except for them the types of data used in other programming languages have been included in Lisp-systems, are various kinds of numbers, lines, vectors, etc.
  Owing to natural expansibility and Lisp openness in language it was simple to define new types of data and means of abstraction of data. In one other programming language there will be no so wide and multilateral choice of ready types of data and means for definition of new types, as in Lisp. However lists and work with them form the base mechanism by means of which it is possible to use and unite in a single whole lisp objects of various types and by means of which it is possible to realize new ways of data presentation.

Classes and methods

  At work with types of data distinguish two basic actions: construction of object and executing of its method. There is in types own method the constructor, it is executed out at creation of object.
  The type of the data made from base or before certain types, name a class. If the new class and the methods connected with it are certain, objects belonging it can be used, not knowing their internal structure, a way of representation and procedure of access of lower level.

In Lisp the type is connected with value, instead of with a name

  In object of data it is possible to distinguish its name, object, or value, and type of object. A name of object is the symbol which is used as a variable or as the representative of object. The type of object defines its general properties.
  In Lisp the type of object of data is connected not with its name, and with object. It Lisp differs from many other things programming languages. For example, in Pascal to names of variables the certain type is appropriated, 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 beginning on the letters i, j and k). Fastening of type is usually carried out at a writing of the program during the moment of the description of a variable, and it cannot be changed during work of the program.
  In Lisp as value the symbol can appropriate object of any type (number, symbol, list, line, vector, stream, object, function, macros, etc.), not caring about type of a variable. The same variable can during the various moments of time and in various conditions to represent lisp objects of various types. Conformity of value of a real situation, for example argument of function, is checked only during concrete calculation.
  Proceeding from that variables have no types, Lisp name language without type. The similar term does not mean that in language in general there are no types of data. Dynamism of types together with abstraction of data and universal definition of actions allows to write down programs in more simple and shorter form, than in traditional languages.

Check and transformation of types

  For the objects having various types, the functions at a 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. Alongside with the predicates distinguishing types (atom, consp, listp, numberp, stringp, vectorp and others), the type of object can be defined and by means of function type-of which returns type of argument as value:

>(nil type-of 'atom)
symbol

  Besides functions of transformation by means of which it is possible to transform objects of data from one type to another are necessary.

>("Abc" list) ; from a string in the list of characters
(#\A #\b #\c)
>(1/3 string)
; from a number in the string
"3.33333333333e-1"

Hierarchy of types

  Types of data form hierarchy of concepts: located below classes of types automatically enter and into more abstract class of the given type located above. Most the general type is the type nil.

  The built in functions certain for type, located above on hierarchy, it is possible to apply and to objects which types belong to lower 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 a designation of similar actions functions with various names.

>(nil string)
"nil"
>(true string)
"true"
>(1 string)
"1"

Definition of new types

  Alongside with already existing types the programmer can define itself with the form defclass the new classes of objects focused on a problem. For classes it is possible to define further hierarchy, for fields to set values by default, using the constructor.
  Differentiation between system and used in the decision of a specific target types often is so complex, as between system and user functions.
  The concept of objects appears especially useful and versatile means for realization of new, especially "active" types. The objective thinking is looked through including in hierarchy of types.