Just thought I'd share a function which has been really useful to me, for 2 reasons

1) It could easily help someone else 2) People might be able to make it work better or point out where it's not optimal

class Array   # Groups elements of an array based on a user-defined condition