More concise implementation of batching functions

AKA "Hey, look at what I've found in the Scala doc for Scala collections this weekend!"

@coderunner @clementgarnier