I don't know if this has been raised before, but I'd like to be able to
supply a simpler block to min and max, taking one argument instead of
two. Currently if objects of a class have some attribute, then finding
the object with the smallest such attribute means doing something like
this:
largest = collection.max {|obj1, obj2| obj1.attrib <=> obj2.attrib}
... but this is characteristic of sorting logic, which does not
presuppose an order. min and max have sufficient inherent meaning that
it seems it should make sense to say
largest = collection.max {|obj| obj.attrib}
Of course it's not a big deal except when the attribute expression gets
a little lengthy, as I came across in a recent project.
Any thoughts?
Mark