Function: -tree-reduce

-tree-reduce is a byte-compiled function defined in dash.el.

Signature

(-tree-reduce FN TREE)

Documentation

Use FN to reduce elements of list TREE.

If elements of TREE are lists themselves, apply the reduction recursively.

FN is first applied to first element of the list and second element, then on this result and third element from the list etc.

See -reduce-r for how exactly are lists of zero or one element handled.

View in manual

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defun -tree-reduce (fn tree)
  "Use FN to reduce elements of list TREE.
If elements of TREE are lists themselves, apply the reduction recursively.

FN is first applied to first element of the list and second
element, then on this result and third element from the list etc.

See `-reduce-r' for how exactly are lists of zero or one element handled."
  (declare (important-return-value t))
  (cond
   ((null tree) ())
   ((-cons-pair? tree) tree)
   ((consp tree)
    (-reduce-r fn (mapcar (lambda (x) (-tree-reduce fn x)) tree)))
   (tree)))