Yuescript icon indicating copy to clipboard operation
Yuescript copied to clipboard

Operators as functions, and partial application of operators

Open Seirdy opened this issue 2 years ago • 2 comments

LiveScript (a descendant of CoffeeScript that also supports features like pipes and spread operators) supports operators as functions, with partial application.

This allows for Polish-like notation:

(in [1 to 3]) 2  # true

It also combines well with pipes:

111 |> (+) 222  # 333

I'd love to see this in Yuescript.

Seirdy avatar Feb 22 '23 05:02 Seirdy

(LiveScript's biop are just Haskell's operator sections)

vendethiel avatar Feb 22 '23 13:02 vendethiel

The in operator is useful to make many comparing expressions simpler, but I'm not getting the use for operator function with partial application, it won't be hard to write functions to generate currying functions, why this should be a builtin feature.

pigpigyyy avatar Feb 27 '23 07:02 pigpigyyy