(2010/09/17 20:10), Nikolai Weibull wrote: > On Fri, Sep 17, 2010 at 13:00, Urabe Shyouhei <shyouhei / ruby-lang.org> wrote: >> (2010/09/17 19:19), Nikolai Weibull wrote: >>> Why doesn¡Çt Enumerable define a #last method that¡Çs analogous to #first? >> >> Simplest counterexample is [1].cycle.last > > I wouldn¡Çt say that that example counters the validity of having #last > in Enumerable. I mean, sure, there¡Çs obviously no last element in > this example, but neither can #all? be answered: > > [1].cycle.all?{ |i| i == 1 } > > even though it has an obvious answer. OK, a bit more complicated example. require "stringio" s = StringIO.new "foobar" e = s.enum_for :each_char s.seek 6 e.last # => nil for your definition, but not sure if it should be? The point is, an Enumerable's last may not exist for various reasons.