1
$\begingroup$

I have 2 functions Top and Bottom that each have an options list parameter.

Top[quads_, optsTop_: OptionsPattern[]]  
Bottom[quads_, optsBottom_: OptionsPattern[]]

Function Top eventually calls function Bottom and passes the options it received directly to the Bottom function. This works like a charm. However now I want to add some options to the ones received in Top to the call to Bottom. These option lists are not lists so an append doesn't work. However, I have no idea how to to this. So conceptually I want to call (from within Top)

Bottom[quads, Append[opsTop, more->"more"]]
$\endgroup$
5
  • 1
    $\begingroup$ Just use Bottom[quads, opsTop, more->"more"] or Bottom[quads, more->"more", opsTop]. The latter should prefer more->"more" over any specification of more in opsTop (options are treated first in-last out). $\endgroup$ – Henrik Schumacher Aug 26 '18 at 13:41
  • $\begingroup$ Thanks for the help. I didn't get it working yet but I guess your answer is correct. I have had a lot of trouble with the Mathematica syntax, especially since it is unlike any other programming language. $\endgroup$ – Willy Van den Driessche Aug 26 '18 at 14:27
  • $\begingroup$ Maybe the issue lies somewhere else. Please consider to provide the whole code you use (maybe reduced by the parts that do not involve handling of options). Ping me with an @ in front of my name in a comment. I will have a look at it. $\endgroup$ – Henrik Schumacher Aug 26 '18 at 14:30
  • 2
    $\begingroup$ Willy, if you use optsTop : OptionsPattern[] (and optsBottom : OptionsPattern[]) when you define Top (resp., Bottom), then you can use Henrik's suggestion to call Top or Bottom with any sequence of options. $\endgroup$ – kglr Aug 26 '18 at 16:59
  • 3
    $\begingroup$ That here seems to explain what you want: mathematica.stackexchange.com/a/355/187 If it indeed solves your problem, I would close this question as a duplicate. $\endgroup$ – halirutan Aug 26 '18 at 17:25

Browse other questions tagged or ask your own question.