Wolfram Language

Core Language

Follow Expression Traversals

Echo and EchoFunction allow reporting the order in which elements of expressions are sequentially visited during pattern matching.

Observe the order in which Cases visits parts of the first level of an expression.

In[1]:=
Click for copyable input
Cases[{a, 2, {7, {1, b}}, 0}, x_ /; NumberQ[Echo[x]]]
»
»
»
»
Out[1]=

Visit all levels of the same expression.

In[2]:=
Click for copyable input
Cases[{a, 2, {7, {1, b}}, 0}, x_ /; NumberQ[Echo[x]], All]
»
»
»
»
»
»
»
»
»
Out[2]=

Related Examples

de es fr ja ko pt-br ru zh