Issue #15799 has been updated by duerst (Martin D=FCrst).


Eregon (Benoit Daloze) wrote:

> To be fair, I don't particularly like Haskell code and find it very crypt=
ic, which this is getting closer to.

Haskell code can be very clear (or very cryptic). In my personal experience=
, I found the $ operator in Haskell one of the most difficult to get used t=
o. It's essentially "replace it by a '(', and add a ')' at the very end of =
the line.

Compared to this, the proposed |> for Ruby seems rather easy in the example=
s that have been brought up until now. The use case seems to be to avoid pa=
rentheses around method arguments rather than parentheses that span all the=
 way to the end of the line. That's more localized and therefore easier to =
grok.

But we haven't seen many different usage examples, and the ones we have see=
n haven't been very convincing, at least not to me.


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

* 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 #=3D> [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=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>