MathGroup Archive 2002

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

Search the Archive

Beginner question on local vars./scoping

  • To: mathgroup at
  • Subject: [mg33660] Beginner question on local vars./scoping
  • From: "Mark Pilloff" <mdp1REMOVETHIS at>
  • Date: Thu, 4 Apr 2002 19:40:53 -0500 (EST)
  • Organization: Texas A&M University, College Station, Texas
  • Sender: owner-wri-mathgroup at


I've written a function of the sort:

function := Do some stuff

The situation is that the 'Do some stuff' depends upon various global vars.
but some of the 'stuff' yields the same result unless some of the global
vars have changed.  I'd like to memoize the results and have some local vars
to function that will remember the value of the global vars when function
was last called and only recompute if necessary.  Right now I have global
vars like lastValueOfVarSeen and lastResultOfStep2 but I'd prefer to make
them local to function but still permanent.

1.  How can I do this?
2.  Is there a better / more standard way to achieve the goal described

Thanks for any help,

  • Prev by Date: HTMLSave
  • Next by Date: Unexpected brainmalfunction [was: Unexpected result with RSolve?]
  • Previous by thread: Re: HTMLSave
  • Next by thread: Re: Beginner question on local vars./scoping