Arc Forumnew | comments | leaders | submitlogin
4 points by pg 5678 days ago | link | parent

Incidentally, does the (or some) Scheme standard allow an implementation to make cons cells immutable? I.e. is supporting set-car! optional?


5 points by CatDancer 5678 days ago | link

Strongly deprecated:

http://www.r6rs.org/final/html/r6rs-rationale/r6rs-rationale...

I participated a bit in the discussion while r6rs was being created, but it quickly became apparent to me that the goals that the editors were striving for weren't things that I personally cared about.

So, anyway, due to the "compromise", can we get mutable pairs if we run MzScheme in r6rs compatibility mode?

a.scm:

  #!r6rs
  (import (rnrs) (rnrs mutable-pairs (6)))

  (define x (cons 'a 'b))
  (set-car! x 'c)
  (write x)
  (newline)

  $ ./mzscheme a.scm
  (c . b)
So yes, though it turns out that in r6rs compatibility mode cons is really just mcons, so we don't actually gain anything.

-----

1 point by herdrick 5678 days ago | link

Interesting. Have you tried r6rs compat mode?

It looks like SRFI 1, at least, isn't working with r6rs: http://list.cs.brown.edu/pipermail/plt-dev/2009-March/000283...

-----

2 points by CatDancer 5678 days ago | link

Have you tried r6rs compat mode?

Not any more than I've shared here.

-----