@@ -317,26 +317,6 @@ defmodule Styler.Zipper do
317
317
if next = next ( zipper ) , do: do_traverse ( next , acc , fun ) , else: { top ( zipper ) , acc }
318
318
end
319
319
320
- @ doc """
321
- Same as `traverse/3`, but doesn't waste cycles going back to the top of the tree when traversal is finished
322
-
323
- Useful when only the accumulator is of interest, and no updates to the zipper are.
324
- """
325
- @ spec reduce ( zipper , term , ( zipper , term -> { zipper , term } ) ) :: term
326
- def reduce ( { _ , nil } = zipper , acc , fun ) do
327
- do_reduce ( zipper , acc , fun )
328
- end
329
-
330
- def reduce ( { tree , meta } , acc , fun ) do
331
- { { updated , _meta } , acc } = do_reduce ( { tree , nil } , acc , fun )
332
- { { updated , meta } , acc }
333
- end
334
-
335
- defp do_reduce ( zipper , acc , fun ) do
336
- { zipper , acc } = fun . ( zipper , acc )
337
- if next = next ( zipper ) , do: do_reduce ( next , acc , fun ) , else: acc
338
- end
339
-
340
320
@ doc """
341
321
Traverses the tree in depth-first pre-order calling the given function for
342
322
each node.
0 commit comments