CCCPaste

elisp mapcat

;; This is an elisp verision of the mapcat function found in the core Clojure library.


(defun mapcat (f &rest xss)
  "Returns the result of applying append to the result of applying
cl-mapcar to f and lists. Thus function f should return a list."
  (cl-assert (cl-every #'listp xss) t "Every item must be a list.")
  (apply #'append (apply (apply-partially #'cl-mapcar f) xss)))