Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Exercises/1-seq.js
Original file line number Diff line number Diff line change
@@ -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 };
3 changes: 2 additions & 1 deletion Exercises/2-array.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

const array = () => null;
const array = (a = [], f) =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use arguments to declare local scope variables

(f = i => a[i], f.push = s => a.push(s), f.pop = () => a.pop(), f);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cryptic code. Rewrite as a block of code, for better reading. Because this function is not in function-programming style, it uses mixins and mutable arrays, so it is not good idea to write it in a functional-style.


module.exports = { array };
2 changes: 1 addition & 1 deletion Exercises/2-array.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
({
name: 'array',
length: [100, 200],
length: [80, 200],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't change tests

test: array => {
{
const arr = array();
Expand Down