In SML, nil is the empty list, also written as [].

nil (or []) is often used as the base case of a recursive function that processes lists. Here is a small function that returns the sum of all elements in a list:

fun sum nil = 0
 |  sum (x::xs) = x + sum xs;

Together with the cons operator (::) nil can be used to create lists. For example, 1::2::3::nil results in the list [1,2,3]. This is mostly used to illustrate how lists are represented in SML. Usually you would just write [1,2,3] if you need that list in a program.

ariels says: Also in the Lisps (Common Lisp) and Scheme. Whether or not nil is an atom is a matter of much debate...

In Pascal (and Delphi), nil is the value of a null pointer, i.e. the special value that indicates that the pointer does not point to something.

Nightmare File System = N = Ninety-Ninety Rule

NIL /nil/

No. Used in reply to a question, particularly one asked using the `-P' convention. Most hackers assume this derives simply from LISP terminology for `false' (see also T), but NIL as a negative reply was well-established among radio hams decades before the advent of LISP. The historical connection between early hackerdom and the ham radio world was strong enough that this may have been an influence.

--The Jargon File version 4.3.1, ed. ESR, autonoded by rescdsk.

Nil (?). [See Nill, v. t.]

Will not.




© Webster 1913.

Nil, n. & a. [L., a contr. of nihil.]

Nothing; of no account; worthless; -- a term often used for canceling, in accounts or bookkeeping.

A. J. Ellis.

<-- (computers) A special value used in certain computer languages to mean "no value", to be distinguished from the value zero. -->


© Webster 1913.

Log in or registerto write something here or to contact authors.