Length of a string or proper list
For a similar function that is logically defined to be equal to zero on any atom, including any string, see len.
Function:
(defun length (x) (declare (xargs :guard (if (true-listp x) t (stringp x)))) (if (stringp x) (len (coerce x 'list)) (len x)))