I know that I can check whether a list of lists only contains null lists like this
CL-USER> (null (find-if (lambda (item) (not (null item))) my-list))
where my-list is a list of lists.
For example:
CL-USER> (null (find-if (lambda (item) (not (null item))) '(nil (bob) nil)))
NIL
CL-USER> (null (find-if (lambda (item) (not (null item))) '(() () ())))
T
But isn’t there a shorter, easier way of doing this in Lisp? If so, how?
The higher order function
everytakes a predicate function and a list and returns true iff the predicate returns true for every element in the list.So you can just do: