diff --git a/.eslintignore b/.eslintignore old mode 100644 new mode 100755 diff --git a/.eslintrc.json b/.eslintrc.json old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.travis.yml b/.travis.yml old mode 100644 new mode 100755 diff --git a/Exercises.ru.md b/Exercises.ru.md old mode 100644 new mode 100755 diff --git a/Exercises/1-seq.js b/Exercises/1-seq.js old mode 100644 new mode 100755 index bdf0fe8..82b100a --- a/Exercises/1-seq.js +++ b/Exercises/1-seq.js @@ -1,5 +1,5 @@ 'use strict'; -const seq = f => g => x => 0; - +const seq = f => g => x => (typeof x === 'number' ? + (typeof f === 'function' ? f(g(x)) : g(x)) : seq(f(g(x)))); module.exports = { seq }; diff --git a/Exercises/1-seq.test b/Exercises/1-seq.test old mode 100644 new mode 100755 diff --git a/Exercises/2-array.js b/Exercises/2-array.js old mode 100644 new mode 100755 index b6d47cf..d7af254 --- a/Exercises/2-array.js +++ b/Exercises/2-array.js @@ -1,5 +1,26 @@ 'use strict'; -const array = () => null; +const array = () => { + const a = []; + const m = i => a[i]; + const push = obj => a.push(obj); + const pop = () => a.pop(); + Object.assign(m, { push, pop }); + return m; +}; + +const arr = array(); + +arr.push('first'); +arr.push('second'); +arr.push('third'); +console.log(arr(0)); +console.log(arr(1)); +console.log(arr(2)); +console.log(arr.pop()); +console.log(arr.pop()); +console.log(arr.pop()); + +console.log(arr.pop()); module.exports = { array }; diff --git a/Exercises/2-array.test b/Exercises/2-array.test old mode 100644 new mode 100755 diff --git a/JavaScript/1-context.js b/JavaScript/1-context.js old mode 100644 new mode 100755 diff --git a/JavaScript/2-chain.js b/JavaScript/2-chain.js old mode 100644 new mode 100755 diff --git a/JavaScript/3-closure.js b/JavaScript/3-closure.js old mode 100644 new mode 100755 diff --git a/JavaScript/4-closure-recursive.js b/JavaScript/4-closure-recursive.js old mode 100644 new mode 100755 diff --git a/JavaScript/5-logger.js b/JavaScript/5-logger.js old mode 100644 new mode 100755 diff --git a/JavaScript/6-functor.js b/JavaScript/6-functor.js old mode 100644 new mode 100755 diff --git a/JavaScript/7-functor-short.js b/JavaScript/7-functor-short.js old mode 100644 new mode 100755 diff --git a/JavaScript/8-adder.js b/JavaScript/8-adder.js old mode 100644 new mode 100755 diff --git a/JavaScript/9-adder-methods.js b/JavaScript/9-adder-methods.js old mode 100644 new mode 100755 diff --git a/JavaScript/a-adder-line.js b/JavaScript/a-adder-line.js old mode 100644 new mode 100755 diff --git a/JavaScript/b-adder-on.js b/JavaScript/b-adder-on.js old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/knowledge.map b/knowledge.map old mode 100644 new mode 100755 diff --git a/package-lock.json b/package-lock.json old mode 100644 new mode 100755 index 53f6ed8..fb6fd81 --- a/package-lock.json +++ b/package-lock.json @@ -148,9 +148,9 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "concolor": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/concolor/-/concolor-0.1.12.tgz", - "integrity": "sha512-8yhwqV92Dngtrf7N2mc0HNCQ7IEZ6M6aXOc0HpHPUhavPcQKvTLnLlaZjEBNilFqHvC3O4AIkcEKdeQ75u0JUw==" + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/concolor/-/concolor-0.1.13.tgz", + "integrity": "sha512-Xazqi7pwBpyP6rQbdANg3hGAlHRSRuhFFXHGQIgWSS7i7Xj7E3BLS9okFpIWvas3UXNkAYLXJa+mNn1zO9DUew==" }, "cross-spawn": { "version": "6.0.5", @@ -410,9 +410,9 @@ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" }, "hpw": { - "version": "0.1.9", - "resolved": "https://registry.npmjs.org/hpw/-/hpw-0.1.9.tgz", - "integrity": "sha512-ce9MEdtxbR1du5/gJlXXy44H1WPaDFCgY52MPIpExhXlkht36ppiG/zE1CktcJGV6/5fK8lQbtPQr+Tu2LwocA==", + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/hpw/-/hpw-0.1.10.tgz", + "integrity": "sha512-nVYhlidhHoJruAgt6LCtPG27Bnz6jnmKCI61QHMb3MyTg+IRdZQtpWo6e5XSDq3zztl1s1Ev0K5QIq3YoMUERA==", "requires": { "concolor": "^0.1.12", "metasync": "^0.3.31" diff --git a/package.json b/package.json old mode 100644 new mode 100755 index 7db5066..621e32d --- a/package.json +++ b/package.json @@ -10,6 +10,6 @@ }, "dependencies": { "eslint": "^6.7.2", - "hpw": "^0.1.9" + "hpw": "^0.1.10" } }