[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Side effecting constants inside functions



    Date: Tue 3 Sep 85 12:05:09-PDT
    From: Evan Kirshenbaum <evan@SU-CSLI.ARPA>

				       Out of curiousity, is there any way
    to define a form which caches values (computes them once) that is not
    self-modifying?

If there's a cache, there must be side-effects on some data structure
somewhere.  Exactly where that state should be depends on what
circumstance should provoke the actual computation.  If the computation
should happen only once per Lisp world, you could put it in a global
variable (or several global variables, or a global variable with
a structured value that can hold several objects).