Skip to content

Conversation

@ermmmaks
Copy link
Owner

@ermmmaks ermmmaks commented Nov 9, 2025

No description provided.

@ermmmaks ermmmaks requested a review from KubEF November 9, 2025 11:09
Comment on lines 5 to 6
if arity < 1:
raise ValueError("Арность должна быть положительной")
Copy link
Collaborator

Choose a reason for hiding this comment

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

А чем вам не угодила нулевая арность?

Comment on lines +8 to +16
def curried(*args):
if len(args) >= arity:
return func(*args[:arity])

def next_curried(*next_args):
return curried(*args, *next_args)
return next_curried

return curried
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ваша реализация допускает такое

def f(a, b, c):
    a + b + c

f_c = curry(f, 3)
assert f_c(1, 2)(3) == 6
assert f_c(1)(2, 3) == 6
assert f_c(1, 2, 3) == 6

Что не хорошо, потому что не вполне соответствует определению каррирования

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