0
$\begingroup$

I would like to define a function that shuts up all warnings.

My first go was:

Silence[x_] := Block[{}, Quiet[x]]; 

I have also tried working with pure functions:

Silence = Block[{},Quiet[#]]&; 

But neither of them seem to work when applied as a function (Silence), whereas they work when I write them down explicitly. Why?

$\endgroup$
2
  • 3
    $\begingroup$ Specifically speaking, just use Attributes@Silence = HoldAll; Silence[x_] := Block[{}, Quiet[x]]; or Silence = Function[x, Block[{}, Quiet[x]], HoldAll]; :) $\endgroup$ Commented Jan 3, 2017 at 12:54
  • $\begingroup$ @xzczd Thanks a lot! $\endgroup$ Commented Jan 3, 2017 at 14:03

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.