From 95514dd2d2bc682cffd7c450ffbabbab011a556e Mon Sep 17 00:00:00 2001 From: Ruslan Date: Fri, 3 Jan 2020 10:56:13 +0200 Subject: [PATCH 1/2] done --- Exercises/2-array.js | 2 +- Exercises/2-array.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Exercises/2-array.js b/Exercises/2-array.js index b6d47cf..62bae13 100644 --- a/Exercises/2-array.js +++ b/Exercises/2-array.js @@ -1,5 +1,5 @@ 'use strict'; -const array = () => null; +const array = (a = [], f) => (f = i => a[i], f.push = s => a.push(s), f.pop = () => a.pop(), f); module.exports = { array }; diff --git a/Exercises/2-array.test b/Exercises/2-array.test index 952d7c6..037f8ce 100644 --- a/Exercises/2-array.test +++ b/Exercises/2-array.test @@ -1,6 +1,6 @@ ({ name: 'array', - length: [100, 200], + length: [80, 200], test: array => { { const arr = array(); From b08404c6e305eed6c6605817d447a34a65690432 Mon Sep 17 00:00:00 2001 From: Ruslan Date: Fri, 3 Jan 2020 11:11:50 +0200 Subject: [PATCH 2/2] fix --- Exercises/1-seq.js | 4 +++- Exercises/2-array.js | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Exercises/1-seq.js b/Exercises/1-seq.js index bdf0fe8..db956c5 100644 --- a/Exercises/1-seq.js +++ b/Exercises/1-seq.js @@ -1,5 +1,7 @@ 'use strict'; -const seq = f => g => x => 0; +//const seq = f => g => x => 0; + +const seq = f => g => (typeof g === 'number' ? f(g) : seq(x => f(g(x)))); module.exports = { seq }; diff --git a/Exercises/2-array.js b/Exercises/2-array.js index 62bae13..042e5a2 100644 --- a/Exercises/2-array.js +++ b/Exercises/2-array.js @@ -1,5 +1,6 @@ 'use strict'; -const array = (a = [], f) => (f = i => a[i], f.push = s => a.push(s), f.pop = () => a.pop(), f); +const array = (a = [], f) => + (f = i => a[i], f.push = s => a.push(s), f.pop = () => a.pop(), f); module.exports = { array };