next up previous contents index
Next: Determining the length of Up: Basic utility abstractions for Previous: Abstraction for the end   Contents   Index


Checking for an empty list: `nullp'

The abstraction `nullp' tests whether a list is empty. The list to be testet must be terminated by `nil'.


\begin{lstlisting}[language=Scm]{}
(define nullp (lambda (l)
(l (lambda (hd tl)
false))))
\end{lstlisting}

\begin{lstlisting}[language=Scm]{}
(define l1 (cons two (cons three nil)))
;
(bdisp! (nullp l1))
--> false
(bdisp! (nullp nil))
--> true
\end{lstlisting}


domain access counter Georg P. Loczewski 2004-03-05