Here's my code:
Options[f] = {"Func" -> Exp};
f[x_, OptionsPattern[]] := OptionValue["Func"][x]
f[2, "Func" -> (# + 2) &]
I expected to get 4 as a return. Instead, it doesn't evaluate anything and returns
f[0, "Func" -> #1 + 2 &]
And the funny thing is that it works just fine when the option is a built-in function instead of a pure function:
Options[f] = {"Func" -> Exp};
f[x_, OptionsPattern[]] := OptionValue["Func"][x];
f[2, "Func" -> Abs]
2
Can someone explain what's wrong with my code?
ColorFunction -> Hue[# + 1/2] &
orRegionFunction -> 2 < #1^2 + #2^2 < 9 &
to those functions when they should have respectively beenColorFunction -> (Hue[# + 1/2] &)
orRegionFunction -> (2 < #1^2 + #2^2 < 9 &)
. $\endgroup$