On 13/07/10 19:04, Martin DeMello wrote: > On Tue, Jul 13, 2010 at 9:50 PM, Maciej Piechotka <uzytkownik2 gmail com> wrote: >> >> Important: >> Iterable<G> >> - A fold(A ()(A, G), A) or A foldl(A ()(A, G), A) - Left fold. >> Can be implemented in terms of Iterable (I shown it in previous e-mail) >> - Iterator<A> scan(A ()(A, G), A) or Iterator<A> scanl(A ()(A, >> G), A) - as fold but returns partial results in iterator >> - Iterator<G> filter(boolean ()(G)) - returns iterator skipping >> elements for which predicate does not hold >> BidirIterable<G> >> - A rfold(A ()(G, A), G) or A foldr(A ()(G, A), A) - Right fold >> - BidirIterator<A> rscan(A ()(A, G), A) or Iterator<A> scanr(A >> ()(A, G), A) - as scan but goes from end. >> Iterable<G> (some of them. Probably should return the 'self' type) >> - Iterable<A> map(A ()(G)) >> Iterator<G> or Iterable<G> (I assume iterator) >> - Iterator<(G, A)> zip(Iterator<A>) - combines elements from both >> iterators as they go >> - Iterator<A> zipWith(A ()(G, B), Iterator<G>) - combine elements >> from both iterators puts them into function and returns the >> >> (+ zip3/4/5 etc.) >> >> Haskell utils (make code nice but they aren't strictly so useful. Often >> can be simply extention of previous): >> Iterable<G>: >> - boolean all (boolean ()(A)) - returns true if predicate is true >> for each element of collection >> - boolean any (boolean ()(G)) - similar to previous >> - Iterator<G> drop(int) - returns iterator skipping n first elements >> - Iterator<G> dropWhile(boolean G()) - skips elements from the >> beginning which hold the predicate >> - Iterator<G> take(int) - last element is n-th element (or earlier) >> - Iterator<G> takeWhile(boolean G()) - iterator returns element >> when it holds predicate >> Iterator<G>: >> - void skip(int) - skip n elements (moves iterator forward) >> - void skipWhile(bool ()(G)) - skip elements from the beginning >> that follow the predicate (moved iterator forward) >> Utils class??? Not needed in non-pure language? >> - Iterator<A> execute(Iterator<A ()>) > > Adding: > > If we're working with external iterators, some collection methods > would be nice to have too: > Sorry - I don't understand the above sentence. > void collect(Collection<G>) - iterates through the iterator and builds > up a collection Exists - instead of x.collect(y) use y.addAll(x); Regards
Attachment:
signature.asc
Description: OpenPGP digital signature