Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
21
Task/Department-numbers/JavaScript/department-numbers-1.js
Normal file
21
Task/Department-numbers/JavaScript/department-numbers-1.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
// concatMap :: (a -> [b]) -> [a] -> [b]
|
||||
function concatMap(f, xs) {
|
||||
return [].concat.apply([], xs.map(f));
|
||||
};
|
||||
|
||||
return '(Police, Sanitation, Fire)\n' +
|
||||
concatMap(function (x) {
|
||||
return concatMap(function (y) {
|
||||
return concatMap(function (z) {
|
||||
return z !== y && 1 <= z && z <= 7 ? [
|
||||
[x, y, z]
|
||||
] : [];
|
||||
}, [12 - (x + y)]);
|
||||
}, [1, 2, 3, 4, 5, 6, 7]);
|
||||
}, [2, 4, 6])
|
||||
.map(JSON.stringify)
|
||||
.join('\n');
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue