3 ms·
I was just thinking about that. You have to do it by hacking the infix syntactic sugar. x |> f = f x gives you lambda calculus, but it gets ugly, since yo
by T-R 16y ago
I was just thinking about that. You have to do it by hacking the infix syntactic sugar.
x |> f = f x
gives you lambda calculus, but it gets ugly, since you need to specify order of operations with parentheses.
(4 |> (5 |> (+))) |> (3 |> (*))
You can take it a step further with tuples, but you still need to be explicit about the number of arguments:
(x,y) |> f = f x y
((4,5) |> (+), 3) |> (*)
Maybe you could go almost all the way by telling it to create a List when passed two values, and telling it apply to the (nested) List when called with a List and an operator, but off hand, I can't think of a way to get it to type check, particularly not without killing currying.