chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] ANN: lazy-seq, a port of Clojure's lazy sequence API


From: Moritz Heidkamp
Subject: Re: [Chicken-users] ANN: lazy-seq, a port of Clojure's lazy sequence API
Date: Sun, 03 Jun 2012 13:31:12 +0200

Alex Shinn <address@hidden> writes:
> First, the srfi-41 vs. lazy-seq comparison in the
> blog post was an apples to oranges comparison
> of a clumsy letrec vs a compact named let.  If we
> rewrite the srfi-41 version in the same style as
> the lazy-seq one, then we get:
>
> (define multiples-of-three
>   (let next ((n 3))
>     (stream-cons n (next (+ n 3)))))

Ah, thanks for pointing this out -- I was really surprised that I
couldn't find a simpler way to express this with SRFI 41. I'll update
the blog article accordingly.


> Now, if we have a whole program or library which
> consistently uses lazy streams instead of lists,
> we can import srfi-41 renaming all the stream-*
> bindings by removing the stream- prefix (this is
> where the drop-prefix you like comes in handy).
> Then you have a normal Scheme library using
> car/cdr/cons etc. which happens to be using
> streams (and you could change the import if
> needed to toggle between the two).

Fair enough. I was actually considering to provide a module which
exports the functions without the `lazy-' prefix, perhaps with a `*'
suffix so that it can be conviently loaded alongside regular Scheme. The
same could be done with SRFI 41, of course. What I don't quite
understand is why SRFI 41 also defines stream-let, stream-lambda etc. Do
you know of a good reason why one would want those?


Moritz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]