0

Trying to map OptionValue to a list of option names doesn't work.

options = {opt1, opt2, opt3};
Options[f] = # -> True & /@ options;
f[x_, o:OptionsPattern[]] := OptionValue /@ options;
f[x_] := f[x, Sequence@{}];

Executing

f[1, opt1 -> False]

gives the result

{OptionValue[opt1], OptionValue[opt2], OptionValue[opt3]}

instead of the expected

{False, True, True}

Why does this happen with OptionValue and can it be fixed?

Tyilo
  • 1,545
  • 13
  • 25

0 Answers0