2008/3/13, James Gray <james / grayproductions.net>: > On Mar 13, 2008, at 6:33 AM, Artem Voroztsov wrote: > > > But i am still interested in: > > 1) Is it a good idea to add method ''first' to Enumerable? > > > You can use Ruby 1.9's take() for this: > > $ ruby_dev -ve 'p((1..10).take(1).first)' > ruby 1.9.0 (2008-03-01 revision 15664) [i686-darwin9.2.0] > > 1 > Thanks. > > 2) Please, show me the _right_ code for Enumerator#skip_first(n=1) > > (ruby1.9) > > > Use take()'s cousin drop(): > > $ ruby_dev -ve 'p((1..10).drop(1))' > ruby 1.9.0 (2008-03-01 revision 15664) [i686-darwin9.2.0] > [2, 3, 4, 5, 6, 7, 8, 9, 10] > > James Edward Gray II > > I want to have 'drop' for Enumerator so that no new collection was created. It's important when collection is big one.