Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!hao!gatech!purdue!i.cc.purdue.edu!j.cc.purdue.edu!pur-ee!iuvax!duba From: duba@iuvax.cs.indiana.edu Newsgroups: comp.lang.scheme Subject: Re: ! Message-ID: <56700001@iuvax> Date: 24 Feb 88 21:14:00 GMT References: <880208@<323426> Organization: Indiana University CSCI, Bloomington Lines: 29 Nf-ID: #R:<323426:880208:iuvax:56700001:000:776 Nf-From: iuvax.cs.indiana.edu!duba Feb 24 16:14:00 1988 ;; This is how we would write the "set!-free" make-cell in Scheme ;; extended with the F-operator and prompts (see Felleisen POPL88). (define (make-cell) (# (rec state (F (lambda (set-state) (lambda (op) (case op [(get) state] [(set) set-state]))))))) ;; Now with just F (define (make-cell) (F (lambda (return-cell) (rec state (F (lambda (set-state) (return-cell (lambda (op) (case op [(get) state] [(set) set-state]))))))))) ;; Of course what this code shows is that in a language with call/cc or F ;; either rec and letrec must be considered side-effects, or they must ;; be fixed so that it is not possible to find out that they are ;; implemented with side-effects. ;; Bruce Duba and Matthias Felleisen