On Sun, Sep 11, 2022 at 3:32 AM Marc Nieper-Wißkirchen <
[email protected]> wrote:


> > I prefer what I've said in the document, as I don't understand all the
>> > implications of what you've written here.
>> >
>> > Brad
>>
>> Can you be more precise about what you don't understand what I have
>> written? Unless I have written nonsensical stuff (which, alas, happens
>> from time to time), I should be able to explain it.
>>
>
I think the point is that a pure (or referentially transparent) procedure
is one that does not visibly mutate (a) any location in the store and (b)
any variable that is free in its body.  Thus:

(define wrapper ()
  (let ((victim '(1 . 2)))
    (define (pure) 46)
    (define (impure-a)
      (set-car! victim 32)
      32)
    (define (impure-b)
      (set! victim #f)
      (pure)
    (pure)
    (impure-a)
    (impure-b))

Reply via email to