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

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



On Wed, Sep 3, 2014 at 2:17 AM, Alex Shinn <alexshinn@x> wrote:
>
> Also for lazy data structures see
> http://www.haskell.org/haskellwiki/Tying_the_Knot,
> for which I have a Scheme version lying around somewhere.

Um, the usual way in which lazy code results in a proper pointer cyclic
is when it goes through some process that translates the lazy structures
into strict ones.

For example, with a (define ones (cons 1 ones)) you don't have a cycle
of pointers, in a similar way that in plain racket you don't get such a
cycle with (define ones (cons 1 (λ() ones))); the cycle is instead
implicit in the semantics of looking up `ones'.  This is similar to the
pointer cycle you implicitly get with (define (onses) (cons 1 ones)).
But it does generate *real* cycle when you display the above value --
the process of translating the lazy structure to a strict one (ie,
removing all promises) results in a real #=0(1 . #0#).

It would be very interesting if you have code that achieves such a cycle
without using mutation.  (Or similar features, like Racket's
`make-reader-graph' which is what Lazy Racket uses; in addition to the
usual mutation that is needed to implement call-by-need.)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports