anchor.diff:                                         (parents keymap)))))))
       (apply #'keymap->map (list-keymaps keymap '()))))
   
  +(declaim (ftype (function (&rest keymap) (or keymap nil)) compose))
   (defun compose (&rest keymaps)
     "Return a new keymap that's the composition of all given KEYMAPS.
   KEYMAPS are composed by order of precedence, first keymap being the one with
  
positive.code:   "Return a keyspecs"
    (coerce (str:join " " (mapcar #'key->keyspec keys)) 'keyspecs-type))
  
  ;; TODO: Declare types.
  (defun keymap->map* (keymap &optional visited) ; TODO: Return a regular hash-table instead?
    "Return a `fset:map' of (KEYSPEC SYM) from KEYMAP."
    (fset:reduce
     (lambda (result key sym)
       (let ((keyspec (key->keyspec key)))
         (if (keymap-p sym)
             (cond
               ((find sym visited)
                (warn "Cycle detected in keymap ~a" keymap)
                result)
               (t
                (fset:map-union result
                                (fset:image (lambda (subkey subsym)
                                              (values (format nil "~a ~a" keyspec subkey)
                                                      subsym))
                                            (keymap->map* sym (cons sym visited))))))
             (fset:with result keyspec sym))))
     (entries keymap)
     :initial-value (fset:empty-map)))
  
  (defun keymap->map (&rest keymaps)
    "Return a `fset:map' of (KEYSPEC SYM) from KEYMAP.
  Parent bindings are not listed; see `keymap-with-parents->map' instead.
  
negative.code:         (push key result)))
      (sort result #'string<)))
  
  (declaim (ftype (function (symbol &rest keymap) (types:association-list symbol keymap))
                  symbol-keys))
  (defun symbol-keys (symbol &rest keymaps) ; TODO: Return hash-table or alist?
    "Return a the list of `keyspec's bound to SYMBOL in KEYMAP."
    (coerce (alex:mappend (lambda (keymap)
                            (let ((hit (symbol-keys* symbol keymap)))
                              (when hit
                                (mapcar (alex:rcurry #'list keymap) hit))))
                          keymaps)
            '(types:association-list symbol keymap)))
  
  ;; TODO: Remap binding, e.g.
  ;; (define-key *foo-map* (remap 'bar-sym) 'new-sym)
  