Count the number of keys in association list
Function:
(defun hons-remove-assoc (k x) (declare (xargs :guard t)) (if (atom x) nil (if (and (consp (car x)) (not (equal k (caar x)))) (cons (car x) (hons-remove-assoc k (cdr x))) (hons-remove-assoc k (cdr x)))))
Function:
(defun count-keys (al) (declare (xargs :guard t)) (if (atom al) 0 (if (consp (car al)) (+ 1 (count-keys (hons-remove-assoc (caar al) (cdr al)))) (count-keys (cdr al)))))