[ruby-core:92433] [Ruby trunk Feature#15799] pipeline operator

From: duerst@...
Date: 2019-04-27 10:28:53 UTC
List: ruby-core #92433
Issue #15799 has been updated by duerst (Martin Dst).


Thanks for creating an issue.

The |> symbol looks reasonable to me, but I'd like to see more examples where this notation is preferable to 

```ruby
(1..).take(10).map {|x| x*2}
```

As for the assignment, just using parentheses looks confusing to me. It's clear we can't use `>=` or `|=`, but `|>=` or some other combination would be much clearer than just parentheses.


----------------------------------------
Feature #15799: pipeline operator
https://bugs.ruby-lang.org/issues/15799#change-77788

* Author: nobu (Nobuyoshi Nakada)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Implemented the pipeline operator `|>`, a topic of "ruby committers vs the world" in RubyKaigi 2019.
Also a casual idea of rightward assignment.

```ruby
1.. |> take 10 |> map {|x| x*2} |> (x)
p x #=> [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
```

https://github.com/nobu/ruby/tree/feature/pipeline




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next