Chromium Code Reviews| Index: corelib/src/collection.dart |
| diff --git a/corelib/src/collection.dart b/corelib/src/collection.dart |
| index 719145acab615314900df2e1bd675bf6b97b6340..59959c65728143e3f599bd21ffc8cdab754287ce 100644 |
| --- a/corelib/src/collection.dart |
| +++ b/corelib/src/collection.dart |
| @@ -14,15 +14,23 @@ interface Collection<E> extends Iterable<E> { |
| /** |
| * Returns a new collection with the elements [: f(e) :] |
| - * for each element [e] of this collection. |
| + * for each element [e] of this collection. |
|
Lasse Reichstein Nielsen
2012/08/08 07:19:14
[:e:]. The 'e' is not referring to an existing var
Anders Johnsen
2012/08/08 07:56:14
I'd like if we could resolve this in another CL. T
Lasse Reichstein Nielsen
2012/08/10 11:26:56
Just fix the [:e:] while you are here, and it'll b
Anders Johnsen
2012/11/12 12:02:56
Done.
|
| * |
| * Note on typing: the return type of f() could be an arbitrary |
| * type and consequently the returned collection's |
| - * typeis Collection. |
| + * typeis Collection. |
| */ |
| Collection map(f(E element)); |
| /** |
| + * Reduce the entire collection to one value value, startign with [init]. To |
|
Lasse Reichstein Nielsen
2012/08/08 07:19:14
"starting". This comment is not very descriptive -
Anders Johnsen
2012/08/08 07:56:14
Agreed, this is a way better comment. Updated.
Cr
Lasse Reichstein Nielsen
2012/08/10 11:26:56
"Nice" is such a loaded word :)
Let's drop it for
|
| + * compute e.g. the sum of a Collection of ints, do |
| + * |
| + * collection.reduce(0, (prev, element) => prev + element); |
| + */ |
| + reduce(var init, f(var prev, E element)); |
|
Lasse Reichstein Nielsen
2012/08/08 07:19:14
Don't abbreviate:
Object reduce(var initialValue
Anders Johnsen
2012/08/08 07:56:14
Returning Object is annoying since you have to 'ca
Lasse Reichstein Nielsen
2012/08/10 11:26:56
Accepted. Use Dynamic or var then.
Anders Johnsen
2012/11/12 12:02:56
Done.
|
| + |
| + /** |
| * Returns a new collection with the elements of this collection |
| * that satisfy the predicate [f]. |
| * |