Skip to content

The |> operator would be great for function composition instead. Explanation... #50

@TheNavigateur

Description

@TheNavigateur

The existing code

const doubleThenSquare = value=>square(double(value))

would be rewritable as:

const doubleThenSquare = double |> square

Reasons to prefer this instead of |> being a function call operator:

  1. Genuinely saves code
  2. The tersely composed functions can be called any time and be tersely used to compose other functions
  3. Has logical consistency (FunctionExpression |> FunctionExpression instead of InputExpression |> FunctionExpression |> FunctionExpression)

Fuller explanation here:

https://github.com/TheNavigateur/proposal-pipeline-operator-for-function-composition
https://esdiscuss.org/topic/native-function-composition

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