Skip to content

Function composition operator mixup #1267

Description

@axch
def (>>>)(f:(a) -> b, g:(b) -> c) -> (a) -> c given (a, b, c) = \x. g(f(x))

The parser still has a precedence for the >>> operator, so I tried to revive it as above. But when I tried running the result, I got this:

3.0 | (exp >>> sq)
> Type error:Wrong number of arugments provided. Expected 2 but got 3
>
> 3.0 | (exp >>> sq)
> ^^^^^^^^^^^^^^^^^^

Why? Because the subexpression in parens parsed as (>>>)(exp, sq), and then the | operator turned it into (>>>)(exp, sq, 3.0). But the error message was not helpful in figuring this out. Do we want a function composition operator, or should we just not bother for now?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions