Function: map-merge-with
map-merge-with is a byte-compiled function defined in map.el.gz.
Signature
(map-merge-with TYPE FUNCTION &rest MAPS)
Documentation
Merge into a map of TYPE all the key/value pairs in MAPS.
When two maps contain the same key, call FUNCTION on the two
values and use the value FUNCTION returns.
Each of MAPS can be an alist, plist, hash-table, or array.
See map-into for all supported values of TYPE.
Probably introduced at or before Emacs version 28.1.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/map.el.gz
(defun map-merge-with (type function &rest maps)
"Merge into a map of TYPE all the key/value pairs in MAPS.
When two maps contain the same key, call FUNCTION on the two
values and use the value FUNCTION returns.
Each of MAPS can be an alist, plist, hash-table, or array.
See `map-into' for all supported values of TYPE."
(let ((not-found (list nil)))
(apply #'map--merge
(lambda (result key value)
(cl-callf (lambda (old)
(if (eql old not-found)
value
(funcall function old value)))
(map-elt result key not-found))
result)
type maps)))