I have written a notebook. I have several functions that I wrote for testing purposes and debugging. However, I would now like to place all the functions that are called by my main function into a package. Many functions are not called and I wish not to include them in the package.
My idea is to copy the notebook (at least the functions in it) into a package file and remove from the package file all the unused functions).
My question is how can I get a list of all the uncalled functions so that I know which functions to remove from the package?
Of course, given the power of Mathematica, I suspect that there must be a better way and that I should be able to write a program that could:
- Read a notebook.
- Figure out the function call tree of a particular function (presumably the main function), and
- Create a package with just the functions called by the main function by copying their definitions in the package file.
Does anyone have any suggestions/solutions? Also, is there a Mathematica function that can generate the function call tree of a given function?