Fix foldRight implementation for iterables

This commit is contained in:
Alexander Zolotov
2012-06-15 13:22:47 +04:00
parent ef1946eee2
commit ae00b0bb15
15 changed files with 35 additions and 21 deletions
@@ -145,7 +145,7 @@ public inline fun DoubleArray.fold(initial: Double, operation: (Double, Double)
*
* @includeFunctionBody ../../test/CollectionTest.kt foldRight
*/
public inline fun DoubleArray.foldRight(initial: Double, operation: (Double, Double) -> Double): Double = reverse().fold(initial, operation)
public inline fun DoubleArray.foldRight(initial: Double, operation: (Double, Double) -> Double): Double = reverse().fold(initial, {x, y -> operation(y, x)})
/**
* Groups the elements in the collection into a new [[Map]] using the supplied *toKey* function to calculate the key to group the elements by