gathers elements of list into sub lists of items whose image under f identical.
GatherBy[list, {f, g, ...}]
gathers elements of list into sub lists of items whose image under f identical. Then, gathers these sub lists again into sub sub lists, that are identical under g.