Length of a list
A Common Lisp function that is appropriate for both strings and proper
lists is
(Low-level implementation note. ACL2 provides a highly-optimized
implementation of
Function:
(defun len (x) (declare (xargs :guard t)) (if (consp x) (+ 1 (len (cdr x))) 0))