9

I love pipes in R. Really wish more mainstream languages would adopt that *looking at you python, nodejs-tc39, rust, cpp*

Just something about doing

data %>% group_by(age) %>% summarize ( count= n() ) %>% print

As oppose to

print(summarize (group_by(data, age), count=n()) )

Comments
  • 0
    Isn't C++ getting them "soon"(tm)?
  • 0
    @Demolishun so as nodejs, hence they are in the list. Rust was rumored to, but it went nowhere, and python is just stanchly against it...
  • 0
    @python3 And in Python, are you sure there isn't an "import pipes" for them already? 😉

    There is for everything else...
  • 2
    Rust iterators are sort of like pipes
  • 0
    @Demolishun there is a way to do that with macros. But it's too much work for just a syntax benefit. It should supported by the syntax tree to be useful.
  • 0
    @python3 Apache Airflow "kind of" does this by overloading the bitshift operators to act like "pipes" and set the dependencies that tasks have on each other.

    https://airflow.apache.org/tutorial...
  • 0
    Looks like active record but uglier
  • 1
    Very ugly
  • 2
    cout << "c++ definitely doesn't support this" << endl;
  • 1
    Pipes are addictive. Once you use them, you can't stop. Code becomes one big massive pipeline and everyone hates you because debugger support for them is a mess.

    But, I definitely want Python to become Coconut. OO and REPL just seems...wrong.
  • 1
    Bash pipes are better looking and cleaner ( | , > , < )
  • 0
    %>% what a gross syntax
  • 2
    Once you are a pipe engineer, you never want back!
    But I have to admit that it looks a bit ugly in R.

    Here's a ReasonML example
  • 0
    Isn't that a marittr pipe? "Ceci n'est pas une pipe!" :-D
  • 1
    @Pogromist other implementation use the |> as operator which looks nicer. But regardless I find it easier to read and even to show management the code when it's written like that.

    I wrote an entire process for filtering, mutating a dataset for the ministry of education in Luxembourg once. And after showing them the code written like that, they actually managed to provide feedback and seemed like they understood it (mind you it's a 50 year old non-programmer person).

    So I'd argue being able to write like this , makes the code more verbose to anyone, including normies
  • 1
    @finiteAutomaton that actually looks nice, but a bit too wordy >.< For when you need to do basic data wrangling. Definitely I can see myself using that for systems or web design
  • 1
    @python3 Yeah, but you can easily assign Map.String to a helper variable. Just for the sake of comprehensability it may be better to be a bit more verbose.
  • 0
    God what the fuck is that syntax though :O
Add Comment