[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>

    Well, it ran on my interpreter (Hedrick's TOPS-20), and that's roughly
    the form I have used in the past.  Out of curiousity, is there any way
    to define a form which caches values (computes them once) that is not
    self-modifying?  I have more than a casual interest, as this is a problem
    we are facing in a language I'm working on.

					    evan
    -------

I have mixed feelings about the ritual legality of this:

(defun switch ()
  (let ((y '#.(generate-cellx)))
    (prog1 (car y) (rplaca y t))))

(defun generate-cellx () (cons nil nil))