Trying to Monitor a process using the postfix notation, as in

Table[Pause[n/10], {n, 5}] // Monitor[#, n] &

fails: the argument Table[Pause[n/10], {n, 5}] is evaluated before being passed to the pure function Monitor[#,n]& because that function does not have the attribute HoldAll like Monitor itself.

An option is to Hold explicitly and release the hold inside the pure function:

Table[Pause[n/10], {n, 5}] // Hold // Monitor[ReleaseHold[#], n] &

Is there a simpler/cleaner/shorter way? Obviously Monitor[Table[...],n] works, but I'd rather separate the code from the monitoring.

  • 1
    $\begingroup$ I tend to use an infix version Table[...] ~Monitor~ n. $\endgroup$
    – wxffles
    Apr 18, 2016 at 21:47
  • $\begingroup$ Ah, I was wrong to insist on postfix. The infix notation is great, I'll use that. $\endgroup$ Apr 19, 2016 at 20:37

2 Answers 2


You can use Unevaluated

Unevaluated@Table[Pause[n/10], {n, 5}] // Monitor[#, n] &

The neater way will be to use the infix version as suggested by wxffles in the comments, but your question specifically asked for postfix so... For completeness, here it is

Table[Pause[n/10], {n, 5}] ~Monitor~ n

Wrap your Monitor call in a Function object endowed with a holding attribute:

Table[Pause[n/10], {n, 10}] // Function[{input}, Monitor[input, n], HoldAll]

This will work as though you had wrapped Monitor around your Table.

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.