2:39 AM
feeling stupid here, since I have already posted a question in this area, mathematica.stackexchange.com/q/43088/9490, but still I don't understand
3 hours later…
5:22 AM
@JasonB. Good morning. Actually, it is not that hard and if you refer to
Plot
then it doesn't use the style that Leonid suggested.
ClearAll[func, checkOpts]; func::optx = "Unknown option `` in ``."; Options[func] = {a -> 1, b -> 2}; PatternTest[func[x_, opts : OptionsPattern[]], Function[arg, checkOpts[arg], HoldFirst]] := x; SetAttributes[checkOpts, HoldFirst]; checkOpts[call : func[arg_, opts : OptionsPattern[]]] := With[{bad = FilterRules[{opts}, Except[Options[func]]]}, If[Length[bad] > 0, Message[func::optx, First[bad], HoldForm[call]]; False, True, True] ]
3 hours later…
8:29 AM
11 hours later…
7:37 PM
2 hours later…
9:26 PM
Options[func] = {a -> 1, b -> 2}; func[x_, OptionsPattern[]] := (OptionValue[b]; 3) func[1, c -> 3] OptionValue::nodef : Unknown option c for func. 3
« first day (2174 days earlier) ← previous day next day → last day (2311 days later) »