logoalt Hacker News

nine_k • today at 1:33 PM • 2 replies • view on HN

Did you even have an RPN-based calculator at school?

As to more serious programming languages, Erlang, F#, Haskell have forms of a "pipe" operator, roughly

  [1 2 3] |> sum |> print
For it to work properly, functions should be either functions of one argument, or support currying.

But the original algebra functions, as introduced by Leibniz in 17th century, were, of course, pure functions, more like properties than procedures. So cos(x), aka cos x, is just a formalized shorthand for "cosine of x", so it preserved the order of words typical for Germanic and Romance languages. Maybe if functions were introduced by the Japanese, we would have the reverse order, kind of x の cos.


Replies

rafaelRiv • today at 2:49 PM

This has been proposed but never adopted : https://github.com/tc39/proposal-pipeline-operator

macintux • today at 2:31 PM

I think you mean Elixir, unless Erlang added a pipe operator in the last 10 years...good grief I've been out of that world too long.

➕ show 1 reply