Skip to content

Should _ fail with ArityError, or return a curried function? #7

Open
@low-ghost

Description

@low-ghost

Improperly handling arity can be a hard to track down source of error, especially when composing functions, but I would want (_ + _)(2) to return a function that looked like "(x1) => (2 + x1)" such that (_ + _)(2, 3) and (_ + _)(2)(3) would be equivalent and both result in 5.

I can understand the intent of the TypeError and it could actually be the best approach to ease problems dealing with composition and with standard python functions, e.g.

list(filter(_ < _, [9,10,11]))

would be problematic. However, it might be worth considering the curried behavior.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions