5 ms·
F# pipeline operator aka... function composition that has existed in other MLs forever?
by vmchale 7y ago
F# pipeline operator aka... function composition that has existed in other MLs forever?
- cultus 7y agoIt's reverse order from normal composition, which is really handy.
- vmchale 7y agoHow tf is reversing order significant?? This is <&> in Haskell (it's in the standard library). Futhark has it in the prelude too.
- oblio 7y agoFor better or for worse, being first doesn't amount to much in real life. Being the first to mass adoption, that does matter.
- vmchale 7y agoIt's not first to mass adoption either lol
- oblio 7y agoWell, I'd say that "mass adoption" means it's in one of: Javascript, Java, Python, C, C++, C#, PHP, Swift†, Ruby†, SQL†, Go†, VBA†, TypeScript†, Kotlin† and that's about it. The languages with a dagger (†) are either niche languages or tied to a very specific (albeit very popular) platform. Which one of them has the pipeline operator, especially in widespread use in libraries in its ecosystem? Personally, I don't know of any. I'm not saying that what this blog post presents has achieved mass adoption, I'm just arguing that the pipeline operator for standard programming languages hasn't reached mass adoption, anywhere. I don't count Unix pipes as being the same thing as the pipeline operator, in this context ;-)
- dnautics 7y agoProbably the only mainstream language with mass pipeline usage is elixir. (And before you call it niche, pagerduty uses elixir, so your stack probably depends on it right now). Almost every significant code file of mine uses the pipe operator, and it's absolutely invaluable for debugging.
- neurotrace 7y agoThat's not really a good argument against calling it niche. A lot of numerical computing done from Python is actually run through Fortran and some of your OS is almost certainly written in raw assembly language. That doesn't mean that they aren't niche.
- deleted 7y ago[deleted]
- galacticdessert 7y agoValue of your comment being? It does not matter where it comes from, just that is cool, useful, readable and it might be a great idea to add it to JS, same as it is already in f#, oCaml, Elixir, etc etc etc.
- mrkeen 7y agoI miss it when it's not there. This is currently #5 on HN: https://www.infoq.com/articles/java-14-feature-spotlight https://www.infoq.com/articles/java-14-feature-spotlight It's a pretty long read and could have done with some precedent.
- LandR 7y agoUnfortunately good ideas take a long time to catch on in our industry!