0

I have a group of Packages that I use to create a lot of other Packages. Let's see an example:

BeginPackage["testPack`",{"auxPack01`","auxPack02`","auxPack03`","auxPack04`"}]
testFunc::usage="testFunc[]"
Begin["`Private`"]
(*...package code...*)
End[]
EndPackage[]

My question is:

How can I create an auxPack (or some other simplification) so, I can just call it, instead of auxPack01, auxPack02 ... or a variable with all the definitions?

I tried to create a variable

$auxPacks={"auxPack01`","auxPack02`","auxPack03`","auxPack04`"}

So I could call

BeginPackage["testPack`", $auxPacks]

But didn't work. I also tried to create my own BeginPackage function as:

   myBeginPackage[packName_String]:=BeginPackage[packName,{"auxPack01`","auxPack02`","auxPack03`","auxPack04`"}]

But didn't work either.

Something similar this last try would be the best option to me. Any clue?

Murta
  • 26,275
  • 6
  • 76
  • 166
  • 1
    Could you elaborate on "didn't work" part, because your both solutions work for me. Problem with them is that $auxPacks or myBeginPackage needs to live in some context, which needs to be on $ContextPath when loading package. – jkuczm Dec 29 '14 at 13:15
  • 1
    You could create a "grouping package": BeginPackage["auxPack`",{"auxPack01`", ...}]; EndPackage[] and then call BeginPackage["testPack`", "auxPack`"] – jkuczm Dec 29 '14 at 13:18
  • Have you used any of suggestions, if so, maybe post selfanswer? :) – Kuba Nov 17 '15 at 07:34
  • @Kuba I will post – Murta Nov 17 '15 at 11:21
  • Related: http://mathematica.stackexchange.com/questions/115502/second-argument-of-beginpackage-with-nested-package-loading – Szabolcs May 19 '16 at 11:07

0 Answers0