Function Repository Resource:

EchoGroup

Source Notebook

Echo a label and make any echoes that occur within a body indented

Contributed by: Taliesin Beynon (Wolfram Research)

ResourceFunction["EchoGroup"]["label"][body]

echoes "label" and indents any echoes that occur within body.

Details and Options

ResourceFunction["EchoGroup"] can be nested and inner groups have larger indentations.
Note: Example outputs viewed on the web may not show the correct indentations. Open the notebook to see accurate examples.

Examples

Basic Examples (2) 

Echo an expression with an echo group:

In[1]:=
ResourceFunction["EchoGroup"]["result"][Echo[2 + 2]]
Out[1]=

Create two echo groups during evaluation:

In[2]:=
ResourceFunction["EchoGroup"]["group one"][Echo[1] + Echo[2]] - ResourceFunction["EchoGroup"]["group two"][Echo[3] + Echo[4]]
Out[2]=

Scope (3) 

Echo several expressions and make operations with them:

In[3]:=
ResourceFunction["EchoGroup"]["result"][Echo[1 + 1] + Echo[2^3]]
Out[3]=

Echo intermediate expressions:

In[4]:=
ResourceFunction["EchoGroup"]["assignments"][Echo[x = 2]; Echo[x + 1]]; x
Out[4]=

Find which expressions are tested:

In[5]:=
expr = {a, {1, b}, 2};
In[6]:=
ResourceFunction["EchoGroup"]["possible matches"][
 Cases[expr, x_ /; NumberQ[Echo[x]], All]]
Out[6]=

Publisher

Enrique Zeleny

Version History

  • 1.0.0 – 02 July 2020

Related Resources

License Information