MathGroup Archive 2010

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

Search the Archive

function local/private to another function?

  • To: mathgroup at
  • Subject: [mg110586] function local/private to another function?
  • From: "Nasser M. Abbasi" <nma at>
  • Date: Sat, 26 Jun 2010 08:41:15 -0400 (EDT)
  • Reply-to: nma at


What is the best way to have a function which can only be "seen" and 
called by only the enclosing parent function? And not be in the global 
space (without using a package?).

Is it something like:


But in the above, "c" is not really local to f2, but local to f1 also, 
because I can't write

     f2[y_]:=Module[{c},...];--> Mathematica complain about "c" here

I Wanted to find what is the best way to have a local function, with its 
own local variables inside a parent function, where the only interaction 
between the inner function and the parent function is via the argument 
call. I looked at Block and With, but they do not do what I need. I 
think Module is the only choice left?  Or should I not bother about 
having local functions to another functions at all and leave everything 
in the global space?


  • Prev by Date: Re: Sum of terms --> list
  • Next by Date: Particle Filters
  • Previous by thread: Re: and sampling a distribution
  • Next by thread: Re: function local/private to another function?