# Tag Info

1

Ad 1 After commenting the second definition, fun[x,y] was evaluated and left in this form since no definition was provided for symbolic arguments. Then the replacement was done and tutorial/Evaluation says: [...] in evaluating an expression like h[e1, e2, ...]. Every time the expression changes, the Wolfram Language effectively starts the evaluation ...

4

f::zero = "x is zero."; f = Compile[{{x, _Complex}}, If[x == 0, Throw[Message[f::zero]; $Failed]; Return[1/x], x^2]]; Catch[f[0]] Or f = With[{cf = Compile[{{x, _Complex}}, If[x == 0, Throw[Message[f::zero];$Failed], x^2]]}, Catch[cf[#]] &]; f[0] In the case of x == 0 there will be one (thanks to the comment by Oleksandr) ...

4

ClearAll[f, fc] f::zero = "x is zero."; (* compiled part *) fc = Compile[{{x, _Complex}}, (* First part of the code; can be anything . . *) If[x == 0, (* Error test*) {0, 0}, (* Error response, first part is status, second part is dummy *) {1, x^2} (* Normal response, first part is status, second part actual result *) ] ]; ...

2

With $tz::tzset = "Unable to set$tz to 1. Time zone should be an integer, real number, a string, or an Entity object."; $tz /: Set[$tz, x_] := If[Internal`PossibleTimeZoneQ[x], OwnValues[$tz] = {HoldPattern[$tz] -> x}; x, Message[$tz::tzset, x, False]]$tz = 1 $\$1 and $tz = "America/Agloe"$tz $\$1

Top 50 recent answers are included