Fundamentals of CS I (CS151 2001S) : Reference

cons: create a list or pair

The Basics

Procedurecons
Parametersv, a value
l, a list
PurposeBuilds a list.
ProducesA list.
PreconditionsTwo parameters (verified).
l is a list (unverified).
PostconditionsThe result is a list. The first element of the list is v. The rest (all but the first element) of the list is l.
Examples
> (cons 'a ())
(a)
> (cons 'a (cons 'b ()))
(a b)

Advanced cons

Coming soon

Disclaimer: I usually create these pages on the fly. This means that they are rarely proofread and may contain bad grammar and incorrect details. It also means that I may update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This page was generated by Siteweaver on Thu Feb 22 05:47:53 2001.
This page may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2001S/cons.html.
You may validate this page's HTML.
The source was last modified Sun Feb 4 10:45:22 2001.