-
-
Notifications
You must be signed in to change notification settings - Fork 110
Lab 1 done #10
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
Lab 1 done #10
Conversation
Exercises/1-seq.js
Outdated
const seq = (...f) => a => (!isNaN(a) ? | ||
f.reduce((v, fn) => fn(v), a) : | ||
seq(a, ...f)); |
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.
Потом подсмотрел это решение у romchik38 .... оно соответсвует формулировке задачи )))
Но это все равно далеко от минимальной длины...
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.
reduce не нужен, нужна рекурсия
Exercises/1-seq.js
Outdated
const seq = (...f) => a => (!isNaN(a) ? | ||
f.reduce((v, fn) => fn(v), a) : | ||
seq(a, ...f)); |
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.
reduce не нужен, нужна рекурсия
Exercises/1-seq.js
Outdated
@@ -1,5 +1,7 @@ | |||
'use strict'; | |||
|
|||
const seq = f => g => x => 0; | |||
const seq = (...f) => a => (!isNaN(a) ? |
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.
Зачем isNaN, нужно проверять typeof, функция ли?
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.
Лучше даже в одну строку все записать
Exercises/1-seq.js
Outdated
@@ -1,5 +1,7 @@ | |||
'use strict'; | |||
|
|||
const seq = f => g => x => 0; | |||
const seq = f => g => x => ((typeof x === 'number') ? |
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.
const seq = f => g => x => ((typeof x === 'number') ? | |
const seq = f => g => x => (typeof x === 'number' ? |
👍 |
Не знаю как даже приблизится к минимально установленной длине ((((