MathGroup Archive 2002

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

Search the Archive

Beginner question on local vars./scoping

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

Hi,

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
above?

Thanks for any help,
Mark




  • 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