[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Proposed new SRFI for immutable lists

On Tue, Sep 9, 2014 at 1:14 AM, Eli Barzilay <eli@x> wrote:
On Thu, Sep 4, 2014 at 9:42 AM, Alex Shinn <alexshinn@x> wrote:
> The original question was whether cycles were possible in "strict
> immutable structures."  I would allow promises as part of that
> structure, and consider them immutable so long as they aren't using
> mutable variables or data structures.

OK, so IOW nothing new.

Indeed, the trick is quite old.

> There's no reason immutable pairs couldn't be implemented in terms of
> promises, in which case the tying the knot trick could be used (under
> the hood) to provide utilities for generating cyclic immutable lists.

IME, it comes out like regular code -- not much different from Racket's
reader graphs which are used to implement cyclic cons structures.  (Only
that requires an explicit step that turns the "reader graph" into a

Yes, but doesn't the conversion from graph to immutable
cons cells require Racket-specific extensions?

I believe for purposes of this SRFI, the question of adding
support for shared structure in ipairs should depend on
whether it can be done portably.

The naive approach would be to define ipairs with setters
and simply not export those setters to the user.  This runs
into problems with future extensions for record introspection.

However, using lazy evaluation one could have truly
immutable, portable records and still provide such
utilities as `circular-ilist' and the equivalent of Racket's


Scheme-reports mailing list