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


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'.


(define nullp 
   (lambda (l)
      (l (lambda (hd tl)
           false))))


(define l1 (cons two (cons three nil)))
;
(bdisp! (nullp l1))
                             --> false
(bdisp! (nullp nil))
                             --> true



Georg P. Loczewski 2004-03-05


Impressum und Datenschutz