title: Group a list of Scala Ints into different intervals?
body: <p>I wasn't sure if <code>groupBy</code>, <code>takeWhile</code>, or <code>grouped</code> would achieve what I wanted to do. I need to develop a function that automatically groups a list of numbers according to the interval I want to specify. The use case is taking a list of ages and sorting them into dynamic age categories (like 1-5, 5-10, etc.). It would need to be dynamic since the user may want to change the intervals.</p>
  
  <p>For example, I have the list of numbers: <code>List(103, 206, 101, 111, 211, 234, 242, 99)</code></p>
  
  <p>I can interval by <code>10</code>, or by <code>100</code>. Then the result of an input of <code>100</code> would be: <code>List(List(99),List(101,103,111),List(206,211,234,242))</code>.</p>
  
  <p>I searched Google and SO for the last hour but couldn't find anything. Thanks for the help!</p>