Tag Info

New answers tagged

2

Here is a method using Off and On triggered by the first appearance of the message. I avoid unprotecting any System Symbols by using TagSetDelayed. I use $Post to turn the message back on. Modification of your function is not required; this operates via the low-level Message system. Code: badness::oops = "Watch out! Result could be ...


3

It's been a day and no has posted a truly elegant, natural, and general solution, so I'll post a narrow one. By default, a message is stopped when it occurs three times in $MessageList. One can reduce the number of times a message is printed by pre-loading $MessageList with it. Block[{$MessageList}, Unprotect[$MessageList]; $MessageList = ...


0

This is a bit ugly, but it seems to do what you want. ClearAll[badness]; badness::oops = "Watch out! Result could be misinterpreted."; badness[0] /; badness[] := (Message[badness::oops]; badness[] = False; 0); badness[_] := 0 Clear[reduction] f[0] = 0; badness[] = True; reduction = {f[x_] :> x + f[x - 1] + badness[0]}; All it does it keep track of ...



Top 50 recent answers are included