moy-fp
Version:
A functional programming library.
24 lines (21 loc) • 557 B
JavaScript
import __ from '../../src/Function/__'
/**
* [(x1, x2, ...) -> a, (x1, x2, ...) -> b, ..., (x1, x2, ...) -> m] -> ((a, b, ..., m) -> n) -> ((x1, x2, ...) -> n)
*/
import converge from '../../src/Function/converge'
test.only('converge(not using __)', () => {
expect(
converge([
(a, b) => a + b,
(a, b) => a - b,
], (x, y) => x / y)(6)(2)
).toBe(2)
})
// test('converge(using __)', () => {
// expect(
// converge(__, (x, y) => x / y)([
// (a, b) => a + b,
// (a, b) => a - b,
// ])(6)(2)
// ).toBe(2)
// })