Martin DeMello wrote: > On 12/17/06, Daniel Finnie <danfinnie / optonline.net> wrote: > >> >> This would allow things like: >> ary = [4, nil, 6, nil] >> ary.select{|x| x.nil?}[1].set(2) >> ary # => [4, nil, 6, 2] > > Seems more generally useful than setting selected elements by index > (internal versus external iterator) Ah, but to get access to the 2nd nil, yours requires an external counter*, whereas select_view can go both ways (potentially): ary.select{|x| x % 2 == 0}.map! {|x| x / 2} (I'd provide a patch, but it's early.) Devin *or a combination of enum_for(:each_with_index) and a non-destructive version of map_if defined in Enumerable.