GNU Info

Info Node: (librep.info)Data Types

(librep.info)Data Types


Next: Numbers Prev: Intro Up: The language
Enter node , (file) or (file)node

Data Types
==========

   The way that data is represented in Lisp is fundamentally different
to languages such as C or Fortran. In Lisp each piece of data (or
"value") has two basic attributes: the data and the _type_ of the data.
This means that type checking is performed at run-time on the actual
data itself, not at compile-time on the "variable" holding the data.

   Also, there are no "pointers" in Lisp. As in the Java programming
language, all values are references to data structures, with each
actual data structure (or "Lisp Object") being able to have as many
values referring to it concurrently as necessary. Because of this lack
of pointers, there can be no memory-leakage in Lisp--when an object has
no more extant references, it is automatically deallocated (Note:
Garbage Collection).

   Most Lisp objects are a member of one of the primitive types; these
are types built into the Lisp system and can represent things like
strings, numbers, cons cells, vectors, etc... Other primitive types may
be defined at run-time.

   More complex objects may be constructed from these primitive types,
for example a vector of three elements could be regarded as a type
`triple' if necessary. In general, each separate type provides a
predicate function which returns true when applied to an object of its
own type.

   Finally, one of the most important differences between Lisp and other
languages is that there is no distinction between programs and data.
But this will be explained later.

Types Summary
List of the most common types
Read Syntax
Some types can be made from source code
Printed Representation
All types can be printed
Equality Predicates
How to test two objects for equality
Comparison Predicates
Comparing two objects as scalars
Type Predicates
Each type has a predicate defining it
Garbage Collection
Reusing memory from stale objects

automatically generated by info2www version 1.2.2.9