But I feel like there is something else going on. If you want to inspect/manipulate a list of things passed by the caller, then that list should probably be a “normal” argument rather than options. It’s kind of the whole point of options that you get some argument values “for free” (using OptionValue) without having to inspect the actual argument list.
I guess it ultimately doesn’t matter, but I’m confused by your assertion that my solution was longer than yours.
First[#] -> OptionValue[First[#]] & /@ Options[f]
is longer than
Merge[Join[Options[f], {options}], Last]
and when you add in all of the other stuff you used, like assignment and Module, the difference is significant. If you’re referring to my putting together a Grid structure, that was just to demonstrate the different views on the options. Presumably you’d only use the bit that you wanted. And there is more to elegance than number of characters used. Merge is a natural operation to use with rules and associations. What you did was take a list of rules, destructure it, and restructure it, which is much more complicated semantically. I suspect that there is even a more elegant way than what I did–I don’t deal with optional arguments very often.
Ok, Eric, you are right. But this question of elegance is not really important for my point. I thought I missed some build in function or option similar zu Options[f] which directly gives all the options used in a function, either explicitly set by the caller or taken from the defaults.