Open mateogianolio opened 8 years ago
mistake in zip function:
export function zip (...xs) {
var r = [],
nple = [],
// should be: length = Math.min(...xs.map(x => x.length))
// or: length = Math.min.call(null, ...xs.map(x => x.length))
length = Math.min(null, ...xs.map(x => x.length));
for (var i = 0; i < length; i++) {
xs.forEach(
x => nple.push(x[i])
);
r.push(nple);
nple = [];
}
return r;
}
Thanks, fixed!
Originally posted
2015-11-12
.This post is the first in a series that will be dedicated to implementating native versions of Haskell functions according to JavaScript ES6 standards. Full source can be found in this GitHub repo. You are more than welcome to contribute!
ƒ.comp
Examples
ƒ.flip
Examples
ƒ.until
Examples
List operations
Examples
Special folds
Examples
ƒ.zip and ƒ.zipWith
Examples