Function: combobulate-ztree-walk

combobulate-ztree-walk is a natively compiled function defined in combobulate-ztree.el.

Signature

(combobulate-ztree-walk INNER OUTER FORM)

Documentation

Using INNER and OUTER, traverse FORM, an arbitrary data structure.

INNER and OUTER are functions. Apply INNER to each element of FORM, building up a data structure of the same type, then apply OUTER to the result. Recognize cons, lists, alists, vectors and hash tables.

Source Code

;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-ztree.el
;;; Walk (recursive tree traversal)

(defun combobulate-ztree-walk (inner outer form)
  "Using INNER and OUTER, traverse FORM, an arbitrary data structure.
INNER and OUTER are functions.  Apply INNER to each element of
FORM, building up a data structure of the same type, then apply
OUTER to the result.  Recognize cons, lists, alists, vectors and
hash tables."
  (cond
   ((and (listp form) (cdr form) (atom (cdr form))) (funcall outer (cons (funcall inner (car form))
                                                                         (funcall inner (cdr form)))))
   ((listp form) (funcall outer (mapcar inner form)))
   ((vectorp form) (funcall outer (apply #'vector (mapcar inner form))))
   ((hash-table-p form) (funcall outer (map-apply (lambda (k v) (funcall inner (cons k v))) form)))
   (t (funcall outer form))))