Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Common Lisp type specifiers

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...)

like image 628
mck Avatar asked Mar 13 '12 20:03

mck


People also ask

Does Common Lisp have types?

Common Lisp has a complete and flexible type system and corresponding tools to inspect, check and manipulate types. It allows creating custom types, adding type declarations to variables and functions and thus to get compile-time warnings and errors.

What is a type specifier?

Type specifiers indicate the type of the object being declared. See the following available kinds of types: Fundamental or built-in types: Arithmetic types.

What is data type in Common Lisp?

In Common Lisp, a data type is a (possibly infinite) set of Lisp objects. Many Lisp objects belong to more than one such set, and so it doesn't always make sense to ask what is the type of an object; instead, one usually asks only whether an object belongs to a given type.

What are the only two types of values in Lisp?

1. Numbers: Numbers are used for storing the integer and floating-point values. Numbers are represented by the symbol number. Lisp has two types of numbers: integer and floating-point.


1 Answers

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.

like image 175
Rainer Joswig Avatar answered Sep 21 '22 23:09

Rainer Joswig