(defun f (x class &optional (index (table-class (xindex-table x))) (range class) (access #'counted-n) (if-missing 0)) (let ((tmp (gethash `(,class ,index ,range) (xindex-counts x)))) (if tmp (funcall access tmp) if-missing))) (defun uses (x class index range) (f x class index range #'counted-all nil)) ;(deftest test-xindex-f () ; (unless (fboundp 'weather2) (loaddata 'weather2)) ; (let ((x (cross-index (weather2)))) ; (check ; (= (f x 'no) 5) ; (= (f x 'no 0 'rainy) 2))))