Skip to content

Instantly share code, notes, and snippets.

@paul-jean
Created January 29, 2014 21:43
Show Gist options
  • Select an option

  • Save paul-jean/8697818 to your computer and use it in GitHub Desktop.

Select an option

Save paul-jean/8697818 to your computer and use it in GitHub Desktop.
Accept additional options for a special case of an existing head in Mathematica
Options[f]={a->1,b->2}
f[x_,opts:OptionsPattern[]]:={x+1,OptionValue[a],OptionValue[b]}
f[s_String,opts:OptionsPattern[Join[Options@f,{c->"c"}]]]:={s,OptionValue[a],OptionValue[b],OptionValue[c]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment