Re:JS things I didn’t know existed
by pg_bot on Saturday January 20, 2018 @08:08AM
(#16193200)
Glad to see that Elixir's pipe operator is beginning to spread to other languages!
[ Parent
| on HN ]
https://en.m.wikipedia.org/wiki/Pipeline_(Unix)
First implemented in Unix V3 1973, acording to wikipedia.
Here is the history of the |> symbol as best as I can tell:
1994: Isabelle/ML (part of Isabelle proof assistant tooling) (https://blogs.msdn.microsoft.com/dsyme/2011/05/17/archeologi...)
2005 and earlier: F#
2012: Elm
2013: Elixir (https://github.com/elixir-lang/elixir/pull/751)
2013: OCaml (https://ocaml.org/releases/4.01.0.html)
Re:JS things I didn’t know existed
by aetherspawn on Saturday January 20, 2018 @09:03PM
(#16196501)
Haskell has had the dot (.) operator which does the same thing for probably longer, but I have no reference sorry. Haskell is >30 years old.
Dot has the arguments swapped.
f |> g = g . fThe $-operator is Haskell's equivalent to |>
Surely you mean OCaml's pipe operator? They have had it since at least 2013: http://ocaml.org/releases/4.01.0.html
I wouldn't be surprised if the syntax was even older. And the functionality has likely been used in some academic language from decades ago. It's just reverse function composition after all.
They seem to have been added around the same time. Another comment on the parent attributes it to F#, which based on a quick googling precedes both OCaml and Elixir. It wouldn't surprise me if the operator preceded that either, but I don't have enough time to explore its origin.
> F#, which based on a quick googling precedes both OCaml and Elixir
F# can’t precedes OCaml because it’s based on it. OCaml was first released in 1996 while F# appeared only in 2002.
Was it in Elixir or F# first?
Bash?
Technically yes, but it is interesting that "|>" seems to be the syntax that is being adopted amongst multiple languages.
Re:JS things I didn’t know existed
by chickenfries on Saturday January 20, 2018 @12:42PM
(#16194325)
Well, we can't use "|".
Although to be fair, using | for "or" has always been silly. Also making the bitwise operator the short one since the logical one gets more usage in the real world. Hindsight is 20/20 of course.