On Fri, 2011-07-22 at 02:20 +0100, Maciej Piechotka wrote: > On Wed, 2011-07-06 at 19:41 +0100, Maciej Marcin Piechotka wrote: > > Sorry for late response. > > > > To sum up the discussion: > > > > 1. A common parent interface for the Iterator and Iterable which returns > > Iterator after calls to map etc. > > > > 2. Add a few more methods (slice). filter/slice require fixing bug in > > vala to provide implementation. > > > > 3. State explicitly in documentation when does the function finish (I'd > > be grateful for any help here) > > > > Open points: > > > > - Name of the parent interface. (Forallable? ;), Foldable?) > > - Should it be implemented as virtual or abstract methods. As I stated > > I prefer C#/Haskell approach then Java and I'm inclined toward the > > virtual methods[1]. > > - Is there any other useful operations (tee?) > > - Should tee/unfold go into parent interface or stay in Iterator > > > > I hope I will have updated patches to share by the end of weekend. > > > > Regards > > > > [1] In this particular case when the operation is clearly defined by the > > default implementation even if it is not necessary the most optimal one. > > Large (+435-195) patch landed into my gitorious branch. Random > sidenotes: > > - I've named it Traversable. It might not be the best name but I'm > still waiting for better sugestion > - The current functions are implemented. I'll add slice, filter. > Implementation of Iterator.tee would be also nice: > > ArrayList<Iterator<G>> tee(Iterator<G>, int n) { ... } > > - Example why the abstract classes would cause problems - currently we > use inheritance internally to share large portion of codes in iterators. > Moving to AbstractIterator would require to duplicate part of code. > - If other maintainers agree (I've added them to CC) I would like to > push the changes to master before the end of Desktop Summit. > > Regards And the patch for collections just landed (I forgot to mention about this). There are no optimalisations right now but it should be possible to write: list.foreach ((elem) => { do_something (elem); }); Avoiding creation of iterator is planned but it will require some internal changes. Regards
Attachment:
signature.asc
Description: This is a digitally signed message part