[ruby-core:93145] [Ruby trunk Feature#15799] pipeline operator
From:
konsolebox@...
Date:
2019-06-14 19:30:10 UTC
List:
ruby-core #93145
Issue #15799 has been updated by konsolebox (K B).
rogeriochaves (Rogerio Chaves) wrote:
> May I give yet another suggestion? What about :., it would keep the visual effect
>
> ```ruby
> 1 + 1
> :. to_s 2
> :. reverse
> :. to_i
> ```
Or \\ maybe. It's much easier to type.
1 + 1 \\ to_s 2 \\ reverse \\ to_i
We can then have |> as an alias to then.
----------------------------------------
Feature #15799: pipeline operator
https://bugs.ruby-lang.org/issues/15799#change-78573
* Author: nobu (Nobuyoshi Nakada)
* Status: Closed
* 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 {|e| e*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:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>