Feature #9071

Enumerable#slice_after

Added by Tsuyoshi Sawada 6 months ago. Updated 6 months ago.

[ruby-core:58123]
Status:Open
Priority:Normal
Assignee:-
Category:-
Target version:-

Description

I see in this discussion: http://ruby.11.x6.nabble.com/ruby-dev-38392-Enumerable-gather-each-td3534746.html that Enumerable#slice_before was named as such, having in mind the possibility of Enumerable#slice_after being implemented in the future. I feel the former convenient, but believe the latter should be as well, and am wondering why the latter was not implemented at the same time. I request it to be implemented.

History

#1 Updated by Akira Tanaka 6 months ago

2013/11/2 sawa (Tsuyoshi Sawada) sawadatsuyoshi@gmail.com:

Feature #9071: Enumerable#slice_after
https://bugs.ruby-lang.org/issues/9071

I see in this discussion: http://ruby.11.x6.nabble.com/ruby-dev-38392-Enumerable-gather-each-td3534746.html that Enumerable#slice_before was named as such, having in mind the possibility of Enumerable#slice_after being implemented in the future. I feel the former convenient, but believe the latter should be as well, and am wondering why the latter was not implemented at the same time. I request it to be implemented.

The main reason is no one requested.

I have not enough time to implement it now.

If you'll implement Enumerable#sliceafter, I recommend not implement
state management
(the 3rd form of Enumerable#slice
before:
enum.slicebefore(initialstate) { |elt, state| bool }).
Now, I think state management should be separeted to another method as
http://bugs.ruby-lang.org/issues/8840#note-5
--
Tanaka Akira

Also available in: Atom PDF