On Jan 25, 11:10 am, Konrad Hinsen <konrad.hin...@laposte.net> wrote:
> For those who like me are playing with the stream-enabled branch of
> Clojure, there is a new module stream-utils on clojure.contrib:
>
> http://code.google.com/p/clojure-contrib/source/browse/trunk/src/
> clojure/contrib/stream-utils.clj
>
> Obviously this is very experimental, and absolutely not ready for use
> in applications. The module defines a couple of stream transformers
> and tools for writing stream transformers. Any feedback is welcome!
>
> As a result of writing this code, I have one modification request for
> Clojure's stream support: it would be very convenient if iters were
> callable, such that one could write (iter eos) instead of (next! iter
> eos). This would make it possible to use iters directly as an
> argument to stream.
>
> Motivation: a stream transformer involves the steps:
>
> stream -> iter -> (transformation) -> generator -> (transformation) -
> > stream
>
> Here "transformation" stands for a function that takes an iter/
> generator and returns a new object of the same kind. There are two
> possible places in this chain to insert a transformation function,
> either at the iter level or at the generator level. I decided to
> implement transformations at the generator level, but one could as
> well do it at the iterator level. But in both cases, there is an
> addition step iterator->generator that is required only because
> iterators and generators have different calling interfaces, although
> they have pretty much the same behaviour.
>
Looks interesting. I made AStream.Iter an IFn, so you can try that.
One thing I would say is that, e.g. drop-first is eager - it drops the
items from the source stream on creation. Streams will let us write
things like drop fully lazily, and that should be the norm.
Rich
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---