Skip to content

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

Closed
wants to merge 4 commits into from
Closed

Lab 1 done #10

wants to merge 4 commits into from

Conversation

avtohem
Copy link

@avtohem avtohem commented Dec 6, 2019

Не знаю как даже приблизится к минимально установленной длине ((((

Comment on lines 3 to 5
const seq = (...f) => a => (!isNaN(a) ?
f.reduce((v, fn) => fn(v), a) :
seq(a, ...f));
Copy link
Author

Choose a reason for hiding this comment

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

Потом подсмотрел это решение у romchik38 .... оно соответсвует формулировке задачи )))
Но это все равно далеко от минимальной длины...

Copy link
Member

Choose a reason for hiding this comment

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

reduce не нужен, нужна рекурсия

Comment on lines 3 to 5
const seq = (...f) => a => (!isNaN(a) ?
f.reduce((v, fn) => fn(v), a) :
seq(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.

reduce не нужен, нужна рекурсия

@@ -1,5 +1,7 @@
'use strict';

const seq = f => g => x => 0;
const seq = (...f) => a => (!isNaN(a) ?
Copy link
Member

Choose a reason for hiding this comment

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

Зачем isNaN, нужно проверять typeof, функция ли?

Copy link
Member

@tshemsedinov tshemsedinov left a comment

Choose a reason for hiding this comment

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

Лучше даже в одну строку все записать

@@ -1,5 +1,7 @@
'use strict';

const seq = f => g => x => 0;
const seq = f => g => x => ((typeof x === 'number') ?
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const seq = f => g => x => ((typeof x === 'number') ?
const seq = f => g => x => (typeof x === 'number' ?

@tshemsedinov
Copy link
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants