Common Lisp the Language, 2nd Edition

Next: Loop Up: Miscellaneous Features Previous: Other Environment Inquiries

# 25.5. Identity Function

This function is occasionally useful as an argument to other functions that require functions as arguments. (Got that?)

[Function]
`identity object`

The object is returned as the value of `identity`.

The `identity` function is the default value for the `:key` argument to many sequence functions (see chapter 14).

Table 12-1 illustrates the behavior in the complex plane of the `identity` function regarded as a function of a complex numerical argument.

Many other constructs in Common Lisp have the behavior of `identity` when given a single argument. For example, one might well use `values` in place of `identity`. However, writing `values` of a single argument conventionally indicates that the argument form might deliver multiple values and that the intent is to pass on only the first of those values.

Compatibility note: In Maclisp, `progn` was a function of any number of arguments that returned its last argument, so `progn` could be used as an identity function. In Common Lisp, `progn` is a special form and therefore cannot be used for that purpose.