[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] Proposed new SRFI for immutable lists
- To: Alex Shinn <alexshinn@x>
- Subject: Re: [Scheme-reports] Proposed new SRFI for immutable lists
- From: Eli Barzilay <eli@x>
- Date: Wed, 3 Sep 2014 23:14:25 -0400
- Cc: John Cowan <cowan@x>, Scheme Specification team <scheme-reports@x>
- In-reply-to: <CAMMPzYN6fGk5n=YYDBzZHs6aZAtxVn7XOW-Q0SOEohQEBvur3A@mail.gmail.com>
- References: <20140901025019.GF5424@mercury.ccil.org> <CAD2CXes8JJOVE0LgQJgPOObV-WzDc9qY6oTOGE=tynb7BGtvrw@mail.gmail.com> <CAMMPzYN6fGk5n=YYDBzZHs6aZAtxVn7XOW-Q0SOEohQEBvur3A@mail.gmail.com>
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