/konz/ or /kons/ A Lisp function which takes an element H and a list T and returns a new list whose head is H and whose tail is T.

In Lisp, "cons" (short for "construct") is the fundamental operation for building structures. It actually takes any two objects and returns them in a "cons cell" or pair object. This is sometimes called a dotted-pair because an application of cons:

	(cons H T)

can also be input and output using an infix dot operator:

	(H . T)

(with suitable quoting of arguments).

A cons cell can also be used as two-branched tree node object with one object hanging from each branch. Because the result of a cons is itself an object, it can be used to build binary trees of any shape and complexity.

Typically, a cons would be represented in memory as a two consecutive pointers.

For historical reasons, the functions to return the objects in a cons are called car and cdr.

[Jargon File]

Last updated: 2014-06-11

Nearby terms:

Co-NPCONSconsconservative evaluationconsidered harmfulconsistently complete

Try this search on Wikipedia, OneLook, Google