Optional named arguments without wrapping them all in “OptionValue”
问题 Suppose I have a function with optional named arguments but I insist on referring to the arguments by their unadorned names. Consider this function that adds its two named arguments, a and b: Options[f] = {a->0, b->0}; (* The default values. *) f[OptionsPattern[]] := OptionValue[a] + OptionValue[b] How can I write a version of that function where that last line is replaced with simply a+b ? (Imagine that that a+b is a whole slew of code.) The answers to the following question show how to