Re: set-car! and set-cdr! throw vm-exception on lists defined with quotation
Taylor R Campbell <[email protected]> Mon, 5 Apr 2010 08:50:35 -0400
| Newsgroups | gmane.lisp.scheme.scheme48 |
|---|---|
| Message-ID | <[email protected]> |
Date: Sun, 4 Apr 2010 21:15:31 +0000 (UTC) From: Andrew Stok <[email protected]> This result was unexpected. The only difference between the two lists is the method in which they were defined. set-cdr! exhibits the same behavior. The values of literal expressions such as quotations are immutable. See the R5RS, Section 3.4 `Storage Model'. Many Scheme systems do not enforce this, but exhibit behaviour such as (let ((f (lambda () '(5)))) (set-car! (f) 3) (car (f))) ;Value: 3 Scheme48, however, enforces this.