I'm currently working on my thesis in category theory, so sometimes I get carried away with the abstract nonsense :D Haskell's nowhere that bad haha.

Anyhow, I can't think of some other sensible tree functions (save for some really abstract functions like horner's scheme for binary trees) that people would use, so it seems like tree.el would be a bit needless dependency. Plus dash is already pretty famous, so that's also a benefit for free.

I wouldn't worry much about performance, I like the mapreduce functions better because they provide nicer interface than composing two functions (and since we add the interface we can make the better performance a free bonus). Again referencing haskell, what I call mapreduce is actually regular "treefold" in haskell.

What reducing is is basically replacing constructors with functions of apropriate arity. In lists, you replace `cons` (haskell `:`) and `nil` (haskell `[]`) with binary `f` and constant value `c`. In binary trees, you have more options to define them:

```haskell
-- data only in tips
data BTree a = Tip a | Bin (BTree a) (BTree a)
-- would have fold of type
(a -> b) -> (b -> b -> b) -> BTree a -> b

-- data in nodes, leaves are empty
data BTree a = Empty | Node a (BTree a) (BTree a)
-- would have fold of type
c -> (a -> c -> c -> c) -> BTree a -> c
```

With "trees" that are in emacs the best definition is what I've posted in the other reply

```haskell
-- notice that this haskell version does not allow for empty list, if so it would need another constructur "Nil" or "Empty"
data Tree a = I a | T [Tree a]

-- first function replaces I constructor, second reduces the list of trees.
fold :: (a -> b) -> ([b] -> b) -> Tree a -> b
fold f g (I a) = f a                         
fold f g (T xs) = g (map (fold f g) xs)      
-- which is what we had in the first draft of -tree-map with (apply ... ) 
-- fold (+1) sum $ T [I 1, I 2, I 3, I 4, T [I 5, I 6]] ~~
-- ~~ sum [(+1) 1, (+1) 2, (+1) 3, (+1) 4, sum [(+1) 5, (+1) 6]]
-- ~~ sum [2, 3, 4, 5, 13] ~~ 27
-- here you can clearly see how the constructors are replaced

-- haskell version with binary folding (what we have now using -reduce / -reduce-from
foldT :: (a -> b) -> (b -> b -> b) -> Tree a -> b
foldT f g (I a) = f a                            
foldT f g (T xs) = foldr g (head l) $ l          
   where l = map (foldT f g) xs     
```

So that leaves us with the fact that the `fold` can simulate map because it is the "true" fold (categorically called "catamorphism" = replacing the constructors)

```haskell
-- replace (I a) with (I (f a)) and leave T as it is.
map f = fold (I . f) T
```

That is impossible to do with `-tree-reduce` because it applies `f` to each item of the list, and if the list isn't reduced to a single element it will get a type error:

```scheme
;; (append acc (list it)) = identity on the list
(--tree-mapreduce-from (+ it 1) (append acc (list it)) nil '(1 (2 3) 4))
;; this would attempt to call (+ (2 3) 1) which is a type error
```

However, now I'm not sure what point I wanted to make.