12
votes
5answers
680 views

How to perform a depth-first preorder traversal of an expression?

Due to confusion of terminology on my part I asked the wrong question before. Since it has already received other answers I shall not edit it, but instead ask the question I meant to in the first ...
16
votes
6answers
647 views

How to perform a breadth-first traversal of an expression?

Mathematica provides functions that perform a depth-first traversal on an expression, including: Map, MapAll, and ...