Function Repository Resource:

EchoEvaluate

Source Notebook

Debug applications of a function more easily by printing its arguments and the result

Contributed by: Taliesin Beynon

ResourceFunction["EchoEvaluate"][f][args…]

yields the same result as f[args], but prints args and the final result.

Examples

Basic Examples (1) 

Define a function and apply its echoed version:

In[1]:=
square[x_] := x^2
In[2]:=
ResourceFunction["EchoEvaluate"][square][2]
Out[2]=

Scope (2) 

Use an echoed function defined as a symbol:

In[3]:=
f[x_, ___] := x
In[4]:=
ResourceFunction["EchoEvaluate"][f][1, 2]
Out[4]=

Echo and evaluate a pure function:

In[5]:=
ResourceFunction["EchoEvaluate"][#^2 &][2]
Out[5]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.0.0 – 06 February 2019

License Information