Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: pipelining operator #35

Open
stugol opened this issue Feb 22, 2016 · 3 comments
Open

Feature request: pipelining operator #35

stugol opened this issue Feb 22, 2016 · 3 comments

Comments

@stugol
Copy link
Contributor

stugol commented Feb 22, 2016

Like the pipe operator, but works on elements of collections. Accepts local free functions, proc objects and blocks. Also accepts methods of the items.

fn(value) -> value + 1
puts [1,2,3] |>> fn |>> fn  -- outputs [3,4,5]
puts [1,2,3] |>> .to_s      -- calls a method on each object, outputs ["1", "2", "3"]

Essentially sugar for map. But nice sugar.

We could also have ?> for select, !> for reject, and so on.

@ozra ozra added the RFC label Feb 25, 2016
@ozra
Copy link
Owner

ozra commented Feb 25, 2016

These are very specific sugars for very specific narrow-use methods.

I went down the road of zillions of operators in Jytron, about two-three years ago, and finally concluded that they sometimes took more screen estate, while still making code less clear. Haskell fails in this regard to, as far as I am concerned.

It does give important food for thought in any event! Some ideas about more general construct for accomplishing above in a terse way starts bubbling in my head. I'll get back to this.

@stugol
Copy link
Contributor Author

stugol commented Feb 25, 2016

Hm. I really like this sugar though :(

@ozra
Copy link
Owner

ozra commented Sep 30, 2016

This has parallels to #89 also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants