tries to separate args into a list of n positional arguments followed by a list of valid options for f.


requires the number of positional arguments to be between min and max.


modifies the behavior based on the information in the association assoc.


  • ArgumentsOptions issues appropriate messages for f and returns a Failure object if f[] has the wrong number of positional arguments, unknown options or invalid option specifications.
  • The following keys can be used for the association assoc:
  • "ExtraOptions"{}additional options to treat as known options for f
    "OptionsMode""Longest"how to interpret the optional positional arguments of args
    "Head"Listwrapper for the positional arguments and options lists
  • Additional options given to "ExtraOptions" can be specified as rules nameval or as symbols func, which is equivalent to Options[func].
  • ArgumentsOptions checks whether all options specified for f have valid names.
  • The following values of "OptionsMode" can be used: »
  • "Longest"treat all trailing elemnts of args matching OptionsPattern[] as options for f
    "Shortest"treat anything other than one or more known options as positional arguments
  • "OptionsMode" only affects the interpretation of positions min+1 through max of args. »
  • ArgumentsOptions has the attribute HoldFirst.


open allclose all

Basic Examples  (1)

Declare the options of the function f:

Separate the arguments to f into exactly one positional argument and options:

Appropriate messages are issued if the arguments to f are invalid:

Scope  (7)

Separate the positional arguments and options for a function that takes between 1 and 3 positional arguments:

Require at least 2 positional arguments:

Calling f with 1 argument is invalid:

Require exactly 3 positional arguments:

Allow "hidden" options that do not appear in Options[f]:

The option a0 is not a known option for f:

Allow the option named hidden as well as any option of Graphics to be set:

Treat unknown trailing options in positions min+1 though max as positional arguments rather than options for f:

The rule b1 is treated as a positional argument:

With the default "OptionsMode""Longest", a message is issued for unknown options:

A known option is always treated as an option for f:

Separate the arguments without evaluating them:

Applications  (2)

Define a function that calls a helper function if called with one or two positional arguments:

When called with one or two positional arguments, the helper function is called:

When called with more than two positional arguments, f returns unevaluated and issues a message:

Use "OptionsMode""Shortest" to treat trailing empty lists as positional arguments:

Properties & Relations  (10)

ArgumentsOptions[f[],] issues a message and returns Failure[] for invalid input to f:

If f does not accept options, all arguments are assumed to be positional:

Options are always returned as a flat list, irrespective of how they appeared in the input expression:

ArgumentsOptions[,{min,max}] will always treat the first min arguments as positional:

Here, even though a0 matches OptionsPattern[], it is treated as a positional argument:

If the rule a0 is given after the positional arguments, it is treated as an option:

Only trailing options are considered when collecting options:

Trailing rules matching OptionsPattern[] are treated as options if they are known options for f:

This is true even if "OptionsMode""Shortest" is given:

An option specification that contains both known and unknown options generates a message:

In "OptionsMode""Shortest", a list with known and unknown options is treated as a positional argument if possible:

An unknown option past the maximum number of positional arguments always generates a message:

Only rules matching OptionsPattern[] can be valid option specifications:

The rule 12 does not match OptionsPattern[]:

Thus it is treated as a positional argument:

If 12 is given after the positional arguments, it is treated as an invalid option specification:

ArgumentsOptions returns Failure[] when CheckArguments returns False:

Possible Issues  (3)

If f accepts options, trailing empty lists are ignored by default because {} matches OptionsPattern[]:

Use "OptionsMode""Shortest" to treat a trailing empty list as a positional argument:

All arguments at or before the minimum argument count are considered positional arguments:

ArgumentsOptions does not check whether the option values are correct:

Infinity is not a valid value for Heads:

Wolfram Research (2020), ArgumentsOptions, Wolfram Language function,


Wolfram Research (2020), ArgumentsOptions, Wolfram Language function,


Wolfram Language. 2020. "ArgumentsOptions." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2020). ArgumentsOptions. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2023_argumentsoptions, author="Wolfram Research", title="{ArgumentsOptions}", year="2020", howpublished="\url{}", note=[Accessed: 03-October-2023 ]}


@online{reference.wolfram_2023_argumentsoptions, organization={Wolfram Research}, title={ArgumentsOptions}, year={2020}, url={}, note=[Accessed: 03-October-2023 ]}