cons
Sign in to saveAlso known as cons cell
In computer programming, '''' ( or ) is a fundamental function in most dialects of the Lisp programming language. constructs memory objects which hold two values or pointers to two values. These objects are referred to as (cons) cells, conses, non-atomic s-expressions ("NATSes"), or (cons) pairs. In Lisp jargon, the expression "to cons x onto y" means to construct a new object with (cons x y). The resulting pair has a left half, referred to as the (the first element, or contents of the address part of register), and a right half, referred to as the (the second element, or contents of the decre
~6 min read
Article
9 sectionsContents
- Use
- Ordered pairs
- Lists
- Trees
- Use in conversation
- Functional implementation
- See also
- References
- External links
In computer programming, '''' ( or ) is a fundamental function in most dialects of the Lisp programming language. constructs memory objects which hold two values or pointers to two values. These objects are referred to as (cons) cells, conses, non-atomic s-expressions ("NATSes"), or (cons) pairs. In Lisp jargon, the expression "to cons x onto y" means to construct a new object with (cons x y). The resulting pair has a left half, referred to as the (the first element, or contents of the address part of register), and a right half, referred to as the (the second element, or contents of the decrement part of register).
It is loosely related to the object-oriented notion of a constructor, which creates a new object given arguments, and more closely related to the constructor function of an algebraic data type system.