Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Unified Diff: runtime/lib/array.dart

Issue 13548002: Add Iterable.fold (and Stream.fold) which replace `reduce`. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/vmstats/bargraph.dart ('k') | runtime/lib/growable_array.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/array.dart
diff --git a/runtime/lib/array.dart b/runtime/lib/array.dart
index 696bfcc5adca81966fdcd329fb5204903ac05ec5..e92744c745ae0d5c62f17922c39976b6bbfafb27 100644
--- a/runtime/lib/array.dart
+++ b/runtime/lib/array.dart
@@ -118,6 +118,10 @@ class _ObjectArray<E> implements List<E> {
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ fold(initialValue, combine(previousValue, E element)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
Iterable<E> where(bool f(E element)) {
return IterableMixinWorkaround.where(this, f);
}
@@ -361,6 +365,10 @@ class _ImmutableArray<E> implements List<E> {
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
+ fold(initialValue, combine(previousValue, E element)) {
+ return IterableMixinWorkaround.fold(this, initialValue, combine);
+ }
+
Iterable<E> where(bool f(E element)) {
return IterableMixinWorkaround.where(this, f);
}
« no previous file with comments | « runtime/bin/vmstats/bargraph.dart ('k') | runtime/lib/growable_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698