Go to the previous, next section.

Type Predicates

The Emacs Lisp interpreter itself does not perform type checking on the actual arguments passed to functions when they are called. It could not do otherwise, since variables in Lisp are not declared to be of a certain type, as they are in other programming languages. It is therefore up to the individual function to test whether each actual argument belongs to a type that can be used by the function.

All built-in functions do check the types of their actual arguments when appropriate and signal a wrong-type-argument error if an argument is of the wrong type. For example, here is what happens if you pass an argument to + which it cannot handle:

(+ 2 'a)
     error--> Wrong type argument: integer-or-marker-p, a

Many functions, called type predicates, are provided to test whether an object is a member of a given type. (Following a convention of long standing, the names of most Emacs Lisp predicates end in `p'.)

Here is a table of predefined type predicates, in alphabetical order, with references to further information.

atom
see section Predicates on Lists

arrayp
see section Functions that Operate on Arrays

bufferp
see section Buffer Basics

byte-code-function-p
see section Byte-Code Function Type

case-table-p
see section The Case Table

char-or-string-p
see section The Predicates for Strings

commandp
see section Interactive Call

consp
see section Predicates on Lists

floatp
see section Type Predicates for Numbers

frame-live-p
see section Deleting Frames

framep
see section Frames

integer-or-marker-p
see section Predicates on Markers

integerp
see section Type Predicates for Numbers

keymapp
see section Creating Keymaps

listp
see section Predicates on Lists

markerp
see section Predicates on Markers

natnump
see section Type Predicates for Numbers

nlistp
see section Predicates on Lists

numberp
see section Type Predicates for Numbers

number-or-marker-p
see section Predicates on Markers

overlayp
see section Overlays

processp
see section Processes

sequencep
see section Sequences

stringp
see section The Predicates for Strings

subrp
see section Accessing Function Cell Contents

symbolp
see section Symbols

syntax-table-p
see section Syntax Tables

user-variable-p
see section Defining Global Variables

vectorp
see section Vectors

window-configuration-p
see section Window Configurations

window-live-p
see section Deleting Windows

windowp
see section Basic Concepts of Emacs Windows

Go to the previous, next section.