These are chat archives for evhub/coconut

23rd
Jun 2017
alanrgan
@alanrgan
Jun 23 2017 00:24
Hi I just stumbled upon Coconut today, and I was wondering if there was any reason lambdas aren't supported in pipelines:
3 |> (x) -> x**2
Evan Hubinger
@evhub
Jun 23 2017 00:39
@alanrgan -> has a lower precedence than |>, so you need to write 3 |> (x -> x**2) instead. You can see the lower precedence if you write |> after ->, as in x -> x |> func. Technically, though, it's a good point that the reverse order is unambiguous, so we could allow 3 |> x -> x**2. Seems worth considering, so I just put it up on #275.
Julian Ospald
@hasufell
Jun 23 2017 06:23
Yeah, too many brackets.
The reason I use coconut is because I want less of them :P
func(func(func(func(x))))

However

3 |> (x) -> x**2 |> (x) -> x + 2

wouldn't be unambiguous then...

Julian Ospald
@hasufell
Jun 23 2017 06:31
However, for haskell both . (function composition) and arrows >>> (which I'd say is closer to the pipe-operator in coconut) also have lower precedence than ->.