I don't think this warrants adding to the Array class, since it's not generalizable to all the types that Arrays can contain.
You could say the same thing about Array#sort
. It can cause an error if elements of the array aren't all of the same type/shape. Just make sure it's safe to use first, and thenArray#sort
, Array#sum
, Array#average
, ... are all quite handy and useful to have on Array class.