Comment Comment by smallnamespace Not sure what collate is supposed to be, but these idioms are hardly difficult if you're used to Python:- groupBy is itertools.groupBy(lst, fn)- sortBy is just lst.sort(key=fn)- countBy is collections.Counter(map(fn, lst))- Sibling comment mentioned flatten, which is just [item for sublist for sublist in lst]More esoteric needs are usually met by itertools. parent smallnamespace 5 years ago
- groupBy is itertools.groupBy(lst, fn)
- sortBy is just lst.sort(key=fn)
- countBy is collections.Counter(map(fn, lst))
- Sibling comment mentioned flatten, which is just [item for sublist for sublist in lst]
More esoteric needs are usually met by itertools.