Boolean Data Type - Lisp and Scheme

Lisp and Scheme

The Lisp language (1958) never had a built-in Boolean data type. Instead, conditional constructs like cond assume that the logical value "false" is represented by the empty list , which is defined to be the same as the special atom nil or NIL; whereas any other s-expression is interpreted as "true". For convenience, most modern dialects of Lisp predefine the atom t to have value t, so that one can use t as a mnemonic notation for "true".

This approach ("any value can be used as a Boolean value") was retained in most Lisp dialects (Common Lisp, Scheme, Emacs Lisp), and similar models were adopted by many scripting languages, even ones that do have a distinct Boolean type or Boolean values; although which values are interpreted as "false" and which are "true" vary from language to language. In Scheme, for example, the "false" value is an atom distinct from the empty list, so the latter is interpreted as "true".

Read more about this topic:  Boolean Data Type

Famous quotes containing the words lisp and/or scheme:

    Taught me my alphabet to say,
    To lisp my very earliest word,
    Edgar Allan Poe (1809–1849)

    Your scheme must be the framework of the universe; all other schemes will soon be ruins.
    Henry David Thoreau (1817–1862)