Same with transducers/reducers, except they work by pushing values through
the pipeline instead of pulling them. The library I started porting from VW
last year had a dual API, one more like the original Clojure transducers,
and one more like Xtreams.

One nice point of going collection→stream & filters→result is that the
final step is explicit, so you can pick what kind of result you build
(could be a collection or a single aggregated value).

On 29 September 2016 at 12:40, Denis Kudriashov <dionisi...@gmail.com>
wrote:

>
> 2016-09-29 12:39 GMT+02:00 Denis Kudriashov <dionisi...@gmail.com>:
>
>> and collect: could be rewritten to use a generator.
>>>
>>> Now does anybody play with this already?
>>>
>>> Does xtream provide a way to do something in the same vein?
>>>
>>
>> Yes. XStream supports it:
>>
>> (1 to: 1000) reading transforming: [:in :out | | each | each := in get.
>> out  put: each -1; put: each; put: each + 1]
>>
>
> But you probably wants different:
>
> (1 to: 1000) reading collecting: [:each | {each -1. each. each + 1} ]
>

Reply via email to