Reputation: 1404
I recently started fiddling with type specifiers to improve code efficiency. This is a list of all the type specifier symbols in the Common Lisp standard.
I can't see the tree through the forest.
Could anyone give (or point to) a short description of the different type specifiers, and when one would use them?
Though I'm interested to learn about all of them, my direct interest goes out to the differences between number related types (fixnum, bignum, float, single-float, short-float, etc...)
Upvotes: 5
Views: 1640
Reputation: 139251
CLtl2 describes a version of Common Lisp before it was standardized. Don't use it as a reference, there are various differences to the standard.
Use the Common Lisp Hyperspec, which is based on the ANSI Common Lisp Standard.
The types of Common Lisp are described in the HyperSpec here: 4.2.3 Type Specifiers. The various types are linked from there.
Upvotes: 8
Reputation: 41170
Here ia a typical implementation:
fixnum
is a small integer that fits in a machine register; it is the fastest integer
bignum
is an integer of unlimited size
double-float
is an IEEE double precision floating point number; it may be very fast, too, depending on your computer
single-float
is an IEEE single precision floating point number; it has less range and precision and may be slower than double, but takes less memory
short-float
and long-float
are often mapped to the two above types, but may also be different, again, depending on your CL implementation
Upvotes: 6