Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

how to automatically include own package into different demonstration

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110577] how to automatically include own package into different demonstration
  • From: "Nasser M. Abbasi" <nma at 12000.org>
  • Date: Sat, 26 Jun 2010 03:11:18 -0400 (EDT)
  • Reply-to: nma at 12000.org

Hello;

The problem: currently when I write a demo, I put all the code into one 
large Manipulate.  When I write another demo, sometimes I'd like to use 
some of the functions I wrote earlier. What I do Now is simply open the 
old notebook, and with the mouse copy/paste the function code from the 
older demo notebook to the new one to use.

This means now, I have the same function in many different notebooks, 
which I do not like.

I'd like to start making a package and put all the useful small 
functions that I write in one package, and somehow include them 
automatically in the new demo.

So, my question is: How do the experts here handle this situation? The 
code of the package has to be actually loaded into the notebook and 
visible before the demo can be submitted. I can't have code such as

    <<mypackage`

in the demo notebook, but the code itself of the package must be there. 
(one can't include non-Wolfram package in a demo, since the source code 
will not be present at the other end, that is why all non-Wolfram code 
must be physically in the demo notebook.)

I am thinking of this: have one package, put in it all the useful 
functions I create and reuse. When writing a new demo, open the package 
notebook, and copy/paste from the package notebook the specific 
functions I need to use in the new demo.

If I found I need to fix something in the function copied, I fix it, and 
copy the corrected version back to the package notebook overwriting the 
old function. This way, I have one master version of the function, and 
not many spread all over the place. How does this sound?

I'd like to really use source control, but I have not looked at using 
source control software with Mathematica notebooks.

note: I just use Mathematica, and not the workbench.

--Nasser


  • Prev by Date: Creating sub-list based on a given criterion
  • Next by Date: Re: Why?
  • Previous by thread: Re: Creating sub-list based on a given criterion
  • Next by thread: Re: and sampling a distribution