Mathieu Bouchard wrote:
....
# And rewriting it to:
#
# x = [1,2,3].find {|i| condition i }
#
# is easy, and allows you to be lazier.
#
# Unless someone has a practical example of code that cannot be boiled
down
# to the simple patterns of each,inject,find,... then I think there is no
# need to worry about the tiresome case above.
Looks pretty functional to me. Plus I think you could almost always use
"(x=1; break)" to do one-liners if exceptions did turn up.
So is it now official that inject is (going to be) one of the standard
Ruby methods?
I certainly hope so, but I didn't find it on
(http://www.rubycentral.com/ref/).
Conrad Schneiker
(This note is unofficial and subject to improvement without notice.)