Well, first question: is this homework? In any case, that is an interesting problem.
There is a function named EVERY. It takes a function and a list and applies that function to every element of that list. If every call to the function returns true, it returns T, otherwise it returns NIL. For instance, this tests if LIST is a list of odd numbers:
If I understood correctly, you can test if something is a list (and not a list of lists) with TRUE-LISTP. In any case it would be something like this:
Code: Select all
(defun true-listp (list)
(and (listp list)
(every #'atom list)))
So, I guess that TRUE-LIST-LISTP is supposed to test if something is a list of lists? Well, that is not hard to do as well:
Code: Select all
(defun true-list-listp (list-of-lists)
(and (listp list-of-list)
(every #'true-listp list-of-lists)))
It should be easy to extract the solution from the pattern you see here. You might or might not want to iterate over the list instead of using EVERY, and perhaps put everything in one single function, but this is pretty much what you need to do.