>>>>> "B" == Brian Candler <B.Candler / pobox.com> writes:

B> Which implementation of 'inject' are you using? The one in PragProg requires
B> an initial value to be passed as a parameter.

svg% cat b.rb
#!/usr/bin/ruby -v
module Enumerable
   def ordered?
      inject { | last, item | return false unless last < item; item }
      true
   end
end

p [1,2,3,1].ordered?
p [1,2,3].ordered?
svg% 

svg% b.rb
ruby 1.8.0 (2003-07-18) [i686-linux]
false
true
svg% 


Guy Decoux