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

Side by Side Diff: runtime/lib/typeddata.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/lib/growable_array.dart ('k') | samples/openglui/src/openglui_canvas_tests.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // patch classes for Int8List ..... Float64List and ByteData implementations. 5 // patch classes for Int8List ..... Float64List and ByteData implementations.
6 6
7 patch class Int8List { 7 patch class Int8List {
8 /* patch */ factory Int8List(int length) { 8 /* patch */ factory Int8List(int length) {
9 return new _Int8Array(length); 9 return new _Int8Array(length);
10 } 10 }
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 305
306 String join([String separator]) { 306 String join([String separator]) {
307 return IterableMixinWorkaround.join(this, separator); 307 return IterableMixinWorkaround.join(this, separator);
308 } 308 }
309 309
310 dynamic reduce(dynamic initialValue, 310 dynamic reduce(dynamic initialValue,
311 dynamic combine(dynamic initialValue, element)) { 311 dynamic combine(dynamic initialValue, element)) {
312 return IterableMixinWorkaround.reduce(this, initialValue, combine); 312 return IterableMixinWorkaround.reduce(this, initialValue, combine);
313 } 313 }
314 314
315 dynamic fold(dynamic initialValue,
316 dynamic combine(dynamic initialValue, element)) {
317 return IterableMixinWorkaround.fold(this, initialValue, combine);
318 }
319
315 Iterable where(bool f(int element)) { 320 Iterable where(bool f(int element)) {
316 return IterableMixinWorkaround.where(this, f); 321 return IterableMixinWorkaround.where(this, f);
317 } 322 }
318 323
319 Iterable expand(Iterable f(int element)) { 324 Iterable expand(Iterable f(int element)) {
320 return IterableMixinWorkaround.expand(this, f); 325 return IterableMixinWorkaround.expand(this, f);
321 } 326 }
322 327
323 Iterable take(int n) { 328 Iterable take(int n) {
324 return IterableMixinWorkaround.takeList(this, n); 329 return IterableMixinWorkaround.takeList(this, n);
(...skipping 2756 matching lines...) Expand 10 before | Expand all | Expand 10 after
3081 return value; 3086 return value;
3082 } 3087 }
3083 return object; 3088 return object;
3084 } 3089 }
3085 3090
3086 3091
3087 void _throwRangeError(int index, int length) { 3092 void _throwRangeError(int index, int length) {
3088 String message = "$index must be in the range [0..$length)"; 3093 String message = "$index must be in the range [0..$length)";
3089 throw new RangeError(message); 3094 throw new RangeError(message);
3090 } 3095 }
OLDNEW
« no previous file with comments | « runtime/lib/growable_array.dart ('k') | samples/openglui/src/openglui_canvas_tests.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698