(defun transpose (x) (apply #'mapcar (cons #'list x))) (defun showh (h &key (indent 0) (stream t) (before "") (after "") (if-empty "empty") (show #'(lambda (x) (format stream "~a~a = ~a~%" (nchars indent) (first x) (rest x)))) (lt #'lt) (limit nil) (ltfun #'car)) (if (zerop (hash-table-count h)) (format stream "~a~a~a" before if-empty after) (let (l) (format stream "~a" before) (maphash #'(lambda (k v) (push (cons k v) l)) h) (mapc show (if (not (null limit)) (subseq (sort l #'(lambda (a b) (funcall lt (funcall ltfun a) (funcall ltfun b)))) 0 limit) (sort l #'(lambda (a b) (funcall lt (funcall ltfun a) (funcall ltfun b)))))) (format stream "~a" after) h)))