Skip to content

Commit a1ef3d7

Browse files
committed
Array foldr should actually fold from the right
1 parent 8a6204e commit a1ef3d7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Data/Foldable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ exports.foldrArray = function (f) {
88
return function (xs) {
99
var acc = init;
1010
var len = xs.length;
11-
for (var i = 0; i < len; i++) {
11+
for (var i = len - 1; i >= 0; i--) {
1212
acc = f(xs[i])(acc);
1313
}
1414
return acc;

0 commit comments

Comments
 (0)