Re: delete_if_with_index or delete_at(array) in 1.8.6?
by Bil Kleb other posts by this author
Jul 2 2009 11:35AM messages near this date
Re: delete_if_with_index or delete_at(array) in 1.8.6?
|
Re: delete_if_with_index or delete_at(array) in 1.8.6?
David A. Black wrote:
> In 1.8 I'm not coming up with anything more elegant than:
>
> >> a.values_at(*(0...a.size).reject {|i| a[i] < i })
> => [0, 1, 2, 4, 6, 7]
Nice.
--
http://twitter.com/bil_kleb
Thread:
Bil Kleb
David A. Black
Bil Kleb
James Gray
Robert Klemme
James Gray
Robert Klemme
Bil Kleb
Robert Klemme
Bil Kleb
|