file: job.t package: muf status: alpha
cons function takes two values and constructs a
List cell containing them as it's
Stack: "a" "d" cons -> cell Stack: cell car cell cdr Stack: "a" "d"
The name is short for "construct", since it constructs a
cons cell, the basic unit of storage in classical
List cells are often called "cons cells", since they are
cons, or simply "conses", and the
process of constructing them is often called "consing".
It is possible to implement arbitrary programs using only
consto modify memory; This train of thought leads to the pure-functional programming community. If this intrigues you, you might grab a Haskell implementation from cs.yale.edu or join the mailing list via firstname.lastname@example.org.
You may sometimes wish to allocate a cons cell
on the stack instead of on the heap: The function
ephemeralCons will do this. For brevity,
it is also available under the synonym
The usual cautions pertaining to ephemerals
apply: See section ]makeEphemeralVector.
Go to the first, previous, next, last section, table of contents.