EchoEvaluation
EchoEvaluation[expr]
prints expr before evaluation, then prints the result after evaluation and returns that result.
EchoEvaluation[expr,label]
prepends label when printing expr before and after evaluation.
EchoEvaluation[expr,label1label2]
prepends label1 before evaluation and label2 after evaluation.
EchoEvaluation[expr,labels,f]
prints expr before evaluation, then evaluates expr to the result res and prints f[res].
EchoEvaluation[expr,labels,gf]
prints g[expr] before evaluating expr and then f[res] after evaluation.
Details
- EchoEvaluation is a variant of Echo that prints an expression both before and after evaluation.
- EchoEvaluation has attribute HoldFirst.
- EchoEvaluation[expr,labels,f] is effectively equivalent to EchoEvaluation[expr,labels,Unevaluatedf].
- The expression before evaluation is shown in a tooltip when hovering over the result.
Examples
open allclose allBasic Examples (3)
Scope (5)
Print an expression before and after evaluation:
Prepend labels before and after evaluation:
Specify print functions for before and after evaluation:
EchoEvaluation can be nested:
To avoid printing nested EchoEvaluation expressions, use this function:
EchoEvaluation does not appear in the printed expressions:
Properties & Relations (5)
EchoEvaluation returns the expression in its first argument:
EchoEvaluation prints the expression before and after evaluation:
Echo only prints the expression after evaluation:
EchoEvaluation uses the same label before and after evaluation:
Specify different labels for before and after evaluation:
EchoEvaluation[expr,label,f] uses f to print the result after evaluation:
In EchoEvaluation[expr,label,gf], the function g is given the unevaluated expression and f is given the evaluated expression:
EchoEvaluation[expr,label] is effectively equivalent to EchoEvaluation[expr,label,UnevaluatedIdentity]:
Possible Issues (1)
In EchoEvaluation[expr,label,gf], the function g must have a holding attribute like HoldFirst or expr will be evaluated twice:
Since Panel does not hold its arguments, the symbol x has been incremented twice:
Text
Wolfram Research (2020), EchoEvaluation, Wolfram Language function, https://reference.wolfram.com/language/ref/EchoEvaluation.html.
CMS
Wolfram Language. 2020. "EchoEvaluation." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/EchoEvaluation.html.
APA
Wolfram Language. (2020). EchoEvaluation. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EchoEvaluation.html