Hacker News new | past | comments | ask | show | jobs | submit login

1. Change . to |

2. Reverse

Now you have:

words | map read | sum

Or..

$ cat words | map -e read | sum






Yes but the notation of dot, plus such function names plus optional parens makes it sure read like English. That’s great but it’ll be a nightmare when you are also dealing with strings which similar English in it.

|> is a common way of writing the pipe in haskell, so

     words |> map read |> sum
IHP uses it a lot.

Would you propose the same change for nested function calls y = f(g(h(x))), changing it into y = x | h | g | f ?

It can look nice. It is like asking: passive or active voice? It depends what you are writing and what makes sense to the reader.

I do like pipelines though!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: