Function Repository Resource:

LimitEcho

Source Notebook

Limit the number of Echo outputs per evaluation

Contributed by: Lukas Lang

ResourceFunction["LimitEcho"][expr,n]

limit the number of Echo outputs printed during evaluation of expr to n.

ResourceFunction["LimitEcho"][n]

limit the number of Echo outputs per evaluation in the entire kernel session.

ResourceFunction["LimitEcho"]["Install",n]

limit the number of Echo outputs in this and all future sessions.

ResourceFunction["LimitEcho"]["Uninstall"]

remove the permanent Echo-limiting.

Details

ResourceFunction["LimitEcho"] limits the number of outputs generated by Echo, EchoFunction and other related functions.
ResourceFunction["LimitEcho"] can prevent the front-end from locking up when a large number of outputs would be printed.
ResourceFunction["LimitEcho"] will print a placeholder for any hidden Echo outputs, with buttons to display those outputs when needed.
ResourceFunction["LimitEcho"][Infinity] effectively removes any limiting.
ResourceFunction["LimitEcho"]["Install",n] effectively installs a paclet "LimitEcho" that is loaded on startup.
ResourceFunction["LimitEcho"] effectively limits the number of outputs be line of evaluated input, as defined by $Line.

Examples

Basic Examples (5) 

Limit the number of Echo outputs to 3:

In[1]:=
ResourceFunction["LimitEcho"][Array[Echo, 15], 3]
Out[1]=

Press the button to show the last 5 outputs:

In[2]:=
ResourceFunction["LimitEcho"][Array[Echo, 15], 3]
Out[2]=

Press the button to show all remaining outputs:

In[3]:=
ResourceFunction["LimitEcho"][Array[Echo, 15], 3]
Out[3]=

Limit the number of Echo outputs for the entire session:

In[4]:=
ResourceFunction["LimitEcho"][3]
Table[Echo[i + 2, "Label"], {i, 5}]
Out[5]=

Remove the limit again:

In[6]:=
ResourceFunction["LimitEcho"][Infinity]
Table[Echo[i + 2, "Label"], {i, 5}]
Out[7]=

Scope (4) 

Outputs from all Echo-related functions are limited, not just Echo:

In[8]:=
ResourceFunction["LimitEcho"][
 Array[EchoFunction["Squared:", #^2 &], 10], 3]
Out[8]=

Limit the number of Echo outputs permanently:

In[9]:=
ResourceFunction["LimitEcho"]["Install", 4]
Echo /@ Range@7
Out[10]=

Change the limit for the current session:

In[11]:=
ResourceFunction["LimitEcho"][3]
Echo /@ Range@7
Out[12]=

Remove the limit again:

In[13]:=
ResourceFunction["LimitEcho"]["Uninstall"]
Array[Echo, 7]
Out[14]=

Possible Issues (2) 

The hidden outputs are no longer available after the kernel is quit:

In[15]:=
ResourceFunction["LimitEcho"][Array[Echo, 5], 3]
Out[15]=

LimitEcho does not work with EchoEvaluation:

In[16]:=
ResourceFunction["LimitEcho"][EchoEvaluation[x = #] & /@ Range@5, 2]
x=11x=1x=22x=2x=33x=3x=44x=4x=55x=5
Out[16]=

Publisher

Lukas Lang

Version History

  • 1.1.0 – 06 March 2023
  • 1.0.0 – 02 September 2021

Related Resources

Author Notes

Changes from version 1.0.0 to 1.1.0:

Improved performance significantly when suppressing large amounts of echos

License Information