Re: Gee Functional iterators
- From: Martin DeMello <martindemello gmail com>
- To: Maciej Piechotka <uzytkownik2 gmail com>, libgee-list gnome org
- Subject: Re: Gee Functional iterators
- Date: Mon, 26 Jul 2010 13:04:02 +0530
On Mon, Jul 26, 2010 at 2:42 AM, Maciej Piechotka <uzytkownik2 gmail com> wrote:
>
> I'm sorry but I fail to see how does it work. Could you show what
> exactly map or other transformation would look like (even in terms of
> interface?).
* Iterable.map() would return View object that holds an iterator and a
list of [function, closure] pairs, where function is either `map` or
`filter` (or maybe split `filter` into `select` and `reject`).
* View.map(closure) would add the closure to the chain.
* Calling `next` on the View would call `next` on the iterator,
retrieve the value and apply the chain of operations to it, then yield
it.
Having a single View with a chain of operations rather than a nested
set of Views each with a single operation makes implementing `filter`
easier, even though nesting Views has more conceptual elegance. Not
sure how fast this would be, but it's very space-efficient.
martin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]