moy-fp
Version:
A functional programming library.
18 lines (15 loc) • 354 B
JavaScript
import __ from '../../src/Function/__'
/**
* ((a, b) -> a) -> a -> [b] -> a
*/
import foldl from '../../src/List/foldl'
test('foldl(not using __)', () => {
expect(
foldl((acc, cur) => acc - cur)(0)([1, 2, 3, 4])
).toBe(-10)
})
test('foldl(using __)', () => {
expect(
foldl((acc, cur) => acc - cur, __, [1, 2, 3, 4])(0)
).toBe(-10)
})