2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1 +1,34 @@
(a,b) => expr_using_a_and_b
(function () {
// curry :: ((a, b) -> c) -> a -> b -> c
function curry(f) {
return function (a) {
return function (b) {
return f(a, b);
};
};
}
// TESTS
// product :: Num -> Num -> Num
function product(a, b) {
return a * b;
}
// return typeof curry(product);
// --> function
// return typeof curry(product)(7)
// --> function
//return typeof curry(product)(7)(9)
// --> number
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
.map(curry(product)(7))
// [7, 14, 21, 28, 35, 42, 49, 56, 63, 70]
})();