-
-
Notifications
You must be signed in to change notification settings - Fork 112
exercise #2 #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
exercise #2 #15
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 }; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
'use strict'; | ||
|
||
const array = () => null; | ||
const array = (a = [], f) => | ||
(f = i => a[i], f.push = s => a.push(s), f.pop = () => a.pop(), f); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 }; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
({ | ||
name: 'array', | ||
length: [100, 200], | ||
length: [80, 200], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't change tests |
||
test: array => { | ||
{ | ||
const arr = array(); | ||
|
There was a problem hiding this comment.
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