Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!russell!evan From: evan@russell.STANFORD.EDU (Evan Kirshenbaum) Newsgroups: comp.lang.scheme Subject: Re: ! Message-ID: <2273@russell.STANFORD.EDU> Date: 10 Feb 88 00:05:19 GMT References: <323426.880208.JAR@AI.AI.MIT.EDU> <8802090251.AA01964@RAVEN.LCS.MIT.EDU> Reply-To: evan@russell.UUCP (Evan Kirshenbaum) Organization: Center for the Study of Language and Information, Stanford U. Lines: 40 In article <8802090251.AA01964@RAVEN.LCS.MIT.EDU> bard@THEORY.LCS.MIT.EDU (Bard Bloom) writes: ] ] Date: Mon, 8 Feb 88 17:44:38 EST ] From: Alan@AI.AI.MIT.EDU ] Sender: JAR@AI.AI.MIT.EDU ] ] (define (make-cell) ] (call-with-current-continuation ] (lambda (return-from-make-cell) ] (letrec ((state ] (call-with-current-continuation ] (lambda (return-new-state) ] (return-from-make-cell ] (lambda (op) ] (case op ] ((set) ] (lambda (value) ] (call-with-current-continuation ] (lambda (return-from-access) ] (return-new-state ] (list value return-from-access)))))) ] ((get) (car state))))))))) ] ((cadr state) 'done))))) ] ] ] ]What the hey is this? A side-effect-free value cell (I think). Cute. For those who take the trouble to walk through it, I think that last call should be to (caddr state) [the return-from-access continuation]. Now can you do it without consing? --- Evan Kirshenbaum Stanford University evan@CSLI.STANFORD.EDU ...!ucbvax!russell.stanford.edu!evan