Many times when someone pastes a piece of code into SE there are missing values and symbols that the user left out.

To prevent this I'm looking for a function that uproots other functions (extract the roots of the function like pulling a plant up from the ground).

I thought there might be something in GeneralUtilities or in some other developer packages...

  • 2
    $\begingroup$ Sorry, I'm lost with your botanical metaphor. Could you try to explain further? $\endgroup$ – Dr. belisarius Mar 29 '16 at 22:05
  • $\begingroup$ Sorry it's spring and I have plants on my mind... I'll add a concrete example. $\endgroup$ – M.R. Mar 29 '16 at 22:06
  • 1
    $\begingroup$ Essentially talking about a dependency tree for a piece of code $\endgroup$ – M.R. Mar 29 '16 at 22:14
  • $\begingroup$ Have you tried DumpSave["filename.mx"] without supplying a second argument? $\endgroup$ – barrycarter Mar 30 '16 at 2:09
  • $\begingroup$ I am dealing with the same issue, while using DumpSave. I did try DumpSave but it does not seem to accept a single argument, at least on MMA 10.2. $\endgroup$ – Trad Dog Mar 30 '16 at 9:17

I think Save is the built-in function that come closest to what you are looking for.

a = 5; n = 1/2;
f[x_] := a + x^2

Save["stdout", f]


|improve this answer|||||
  • $\begingroup$ What it f relied on a function g which relied on a function h in package i? $\endgroup$ – M.R. Mar 30 '16 at 0:43
  • 1
    $\begingroup$ You could try it and see what happens. You could reflect on the fact that definitions of Plus and Power don't show up. $\endgroup$ – m_goldberg Mar 30 '16 at 1:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.